Re: Is there a getch()?

From: Eric Green (egreen@cypronet.com)
Date: 02/10/96


>
>        btw I would like to get in touch with who ever was trying to use
>pico/vi for a mud editor, I have been considering such a transplant, and
>would like any pointers or hints I can get
>

I don't think think it would terribly difficult to transplant pico (or vi)
to use as an editor in circle, providing you weren't tight on resources.
To do this, you could:

 - tell the client to switch to character mode.  This done the same way as
toggling echo on and off, except using TELOPT_SGA instead of TELOPT_ECHO.

 - turn off echoing.  The server becomes responsible for producing echos.

 - open a pty pair.  Stevens has a couple of good chapters in "Advanced
Programming in the UNIX Environment" and "UNIX Network Programming" on
pseudo-terminals, and most of the code needed can be taken directly from
there.  In the main game loop, any data that comes in from the character's
socket needs to be written to the master pty descriptor, and data from the
master must be written to the socket.  In this mode, process_input() is
never called.

 - set the pty in the correct mode.

 - fork() the mud and dup() stdin/out/err to use the slave pty's descriptor.

 - exec() a modified pico.  Pico has a mode which is designed to be fairly
secure, and with a little extra modification it should prevent any access
to other files.  The file browser needs to be disabled, along with file
listing and the ability to write a new file.

 - when pico exits, the mud catches the SIGCHILD and reads in the its file.
The child's process id would indicate which file to read and who wrote the
file.  The contents of this file is copied to the approriate buffer.

 - close the ptys, turn on echoing, revert to canonical mode.

Its not exactly easy for a beginner, but if you are familiar with UNIX
programming, its not difficult.  You do have to account for needing the
extra system resources for each pico process.


I'm working on an editor now which is completely contained in the mud.
Screen manipulation is done through vt100 commands, so most of the work is
done by the client.  This will also be a base for a menu driven OLC
interface, so you can toggle flags with the space bar and move between
fields with a tab key or arrow keys.  With it being internal to the mud, it
is also a lot easy to add things such as a small window which allows
someone editing to see channels.

Now if i can just find a decent reference for using vt100 codes...

Eric

----------------------------+-----------------------------------------------
Eric Green                  |   "To Death Gate.  'Prepare ye the way.'"
egreen@cypronet.com         |                                       Lord Xar
http://www.cypronet.com/~dg |



This archive was generated by hypermail 2b30 : 12/07/00 PST