BSD vs. SVR4 typehead flush after tty mode change

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Fri Oct 5 13:52:16 AEST 1990


In article <1990Oct4.213623.27362 at smsc.sony.com> dce at smsc.sony.com (David Elliott) writes:
  [ cat /etc/passwd | more > /dev/null flushes tty input on SVR4 ]
> Is there an stty setting that will fix this?

Under BSD, if your tty is normally in cbreak -echo mode (as some shells
prefer), this sort of problem may go away. Smart programs won't change
the mode; even for those that do, the tty driver might not flush input
for a noop. So I wonder what happens if you use ksh in an editing mode.

> Is it just a difference
> between the operating systems, or is it a problem with 'more' changing
> the tty mode when it shouldn't?

Almost certainly the latter, since more shouldn't be talking to the tty
at all.

> I should also mention that similar things happen when I am getting
> out of vi.  It's annoying to lose typeahead, and I generally
> think a few seconds ahead of myself.

I agree. One strategy to fix this, on BSD systems, is to change TIOCSETP
to TIOCSETN. On this system the only difference between the calls is
between a 32-bit 9 and a 32-bit 10, so it should be easy to find out
where to patch the binary.

---Dan



More information about the Comp.unix.questions mailing list