How to mimic the terminal driver?

The Demented Teddy Bear dieter at titan.nmt.edu
Wed Nov 30 20:47:39 AEST 1988


In article <35 at umvlsi.ECS.UMASS.EDU>, vishwana at umvlsi (Chidambaram Vishwanath) writes:
> 
>      I have taken upon myself the following task, viz.,: I want to add 
> an extra feature to the C-shell whereby I can recall earlier commands
> by pressing an arrow-key.

By far the easiest solution to this problem is to use "ile", which was
posted to comp.unix.wizards on July 7, 1988 by bpendlet at esunix.uucp.
(Bob Pendleton, message id 907 at esunix.uucp, to be exact).  It fits
between the user and his program by grabbing a pty and looking at
everything that goes by.

There are three problems with this package that I'm aware of.

1) Your version of unix must understand the concept of pty.  This seems
   to be fairly common these days, so it isn't too much of a problem.

2) It grabs a pty, but doesn't update /etc/utmp, which upsets "talk" and
   other programs that do a getlogin ().  This is pretty easy to fix (I
   just finished doing that about 4 hours ago, you see).

3) To keep things from getting real confused, the tty never echoes (i.e.,
   the child's end doesn't echo), but the pty does.  Therefore, there's
   no way for ile to know that the child would like echoing turned off.
   Translation:  passwords echo.  I haven't figured out a nice way around
   this yet.

4) There's no clear concept of "current directory".  Since this would
   require something of a Know-What-I-Mean function, there's not much
   that can be done about it.

Some advantages:

1) Ile notices when the child puts the tty into raw mode, and gets out of
   the way.  Things like Emacs still work.

2) You now have an Emacs-like user interface.  Things like ^A, ^E, ^T
   ESC-u, etc, all work.  You can change the default key bindings to
   whatever you prefer.  Characters insert by default.

3) File name completion exists, but only on absolute paths (start with
   a / or ~).  I haven't figured out how to get an escape through to the
   shell for its completion yet, assuming it's possible.

4) *All* line-oriented programs suddenly have history, with a nice line
   editing capability.  Ile maintains its own history list (accessed via
   ^P and ^N by default), and doesn't distinguish between what subprocess
   is reading from the pty.  It's real convenient being able to pop up
   the history list and grab the command line you typed at the wrong program
   and give it to the right program.  You don't need one of those
   "...relentlessly interactive, icon-based, rodent-infested, dumb-user-
   friendly, smart-user-crippling systems..."[*] any more.

I have the original message (as you probably guessed from the exactness
in identification given at the top).  The diffs for diddling utmp nicely
(cleans up after itself and such) are fairly small, and on their way to
the original author.

Please note that I will not be at this email address after Dec 12, so
either get any requests in to me quickly, or send a note off to Mr.
Pendleton.

[*] Thanks to Mike Van Pelt for that description.

Dieter Muller
-- 
Welcome to the island.  You are number six.
dieter%nmt at relay.cs.net
dieter at jupiter.nmt.edu



More information about the Comp.unix.questions mailing list