Short: ed ideas
From: Matthew Julius <julius.2@wright.edu>
Date: Fri, 08 Jan 1999 16:29:08 -0500
Type: Feature
State: Unclassified
Something else from the MudOS CHANGELOG,
* added a new interface for ed(), which is used if OLD_ED is not
defined in options.h
. Three new efuns replace ed():
string ed_start(string | void, int | void) - start a new ed
session on file file. ed_start(foo, 1) means use
restricted mode. Only one ed session may be started
per object.
string ed_cmd(string) - send the command line to ed
int query_ed_mode() - returns:
0 - the current object is at a normal ed prompt (':')
-1 - the current object isn't in ed
-2 - the current object is at the more prompt in the
middle of help
>0 - the object is at a prompt for a line. The number
is the line number.
. The string result of ed_cmd() and ed_start() is the output
that would have been sent to the user
. The mudlib is responsible for setting the user's prompt
(see query_ed_mode())
This is the right idea, but I really dislike the MudOS interface efuns. If
compatibility is desired, however, I can't really object much. Particularly,
my problem is with query_ed_mode(), which I think should return 0 if the
object is not in the editor. Also, problems exist if it's desired to have
the ed prompt print the current line number. This looks to be impossible
using query_ed_mode(). The -2 value, being in the middle of ed help, should
be put into ed_cmd(). If ed_cmd() returned the help as a string the mudlib
could determine how to display it--which is nice for users that have more
than 20 lines on their screen. Like I said, these additions to ed() are
the right idea, but the wrong implementation.