les@chinet.chi.il.us (Leslie Mikesell) (12/20/88)
[Re: rn doesn't work when the login is over the starlan tty server
and suggestion that the ioctl()s for raw mode have a problem.]
I can't believe that there is a general problem with raw mode over a
starlan login, since that would prevent almost all editors from working.
The problem is that starlan is a STREAMS device and when O_NDELAY is set
a read() with no data present returns -1 just like TFM says. (Personally
I think that when the tty emulation module is pushed on the stream it
should act like a tty and return 0, but...).
Rn (and GNU EMACS) take the value returned by read() to be the number of
characters read without checking for negative numbers. I don't have
news running on a machine with starlan to test this but try making the
following changes:
In term.h change the line:
#define input_pending() (is_input || (is_input=read(devtty,&pending_ch,1)))
to:
#define input_pending() (is_input || (is_input=read(devtty,&pending_ch,1) >0))
and in term.c before the line:
if (howmany) {
add the line:
if (howmany < 0) howmany = 0;
If there happens to be an error in this, the intent is to treat negative values
returned by read() as 0. A better approach might be to also check errno for
EAGAIN so that other errors could be detected. This change should not affect
normal tty usage.
Les Mikesell