|
LPC Library Functions: ed |
|
NAMEed() - edit a file
SYNOPSISvoid ed( string file | void, string exit_fn, int restricted ); void ed( string file | void, string write_fn, string exit_fn, int restricted );
DESCRIPTIONed() starts the driver's built-in line editor, which is similar to UNIX ed(1) or ex(1). Once in the editor, type 'h' for help. If the optional parameter 'file' is included, ed() will attempt to load the file for editing. If the file does not exist, ed() will inform the user with the message "No file." The 'write_fn' parameter allows you to specify a mudlib function which will do pre- or post-processing on ed's attempt to write its buffer to disk. When the editor is about to write to the file 'file', the driver will call the function 'write_fn' with 'file' as the first parameter and '0' (zero) as the second parameter. If 'write_fn' returns TRUE, the write takes place; otherwise, it will abort. Once ed() has completed the write operation, 'write_fn' will be called again with 'file' as the first parameter and '1' (one) as the second parameter. The callback function 'write_fn' should have the form:
int write_fn(string fname, int flag)
The 'exit_fn' parameter enables you to specify a mudlib function which will do processing when the user exits the editor. This callback function has the form:
void exit_fn()
The optional 'restricted' flag limits the editor's capabilities, and prevents
the following operations:
This efun is only available if the driver flag OLD_ED is defined. SEE ALSO |
|
Page design by Frank Jacquette & Tim Hollebeek Copyright (C) 1998 Tim Hollebeek & Frank Jacquette |
|