[comp.unix.programmer] Need help setting up termios with pty

czim@camus.cns.caltech.edu (Chris Ziomkowski) (04/12/91)

For various reasons, I need to write a program that acts similarly to rlogin.
I've managed to open up a pseudo terminal but am having trouble figuring out
how to set up the termios on the master side.  I think I'm missing a basic
concept of how this works.

I'm writing for a Berkely environment, and currently I'm using non blocking io
to read() characters from stdin and then write() them to the master. I have
another process where I read() from the master using non blocking io and then
write to stdout.  This works all fine and dandy, except that I can't figure out
how to get erase and kill processing to work. For instance, when the slave is
executing a program like csh, hitting the rubout key should echo bs-sp-bs to
the screen. On the other hand, when running a program such as emacs, no such
processing should occur. Basically, a program can set the slave up any way it
wants to. I have a canonical input processor that I wrote a while back which I
could use while reading from stdin, but then programs such as emacs and vi would
not work properly. How should I deal with this? Does anyone know how programs
such as rlogin and telnet get around this problem?

Any help will be greatly appreciated.

Thanks in advance...

Chris.
czim@cns.caltech.edu