BSD vs. SVR4 typehead flush after tty mode change

Keith Gabryelski ag at cbmvax.commodore.com
Thu Oct 11 02:56:01 AEST 1990


In article <14028 at smoke.BRL.MIL> gwyn at smoke.BRL.MIL (Doug Gwyn) writes:
>In article <10704 at uudell.dell.com> jrh at mustang.dell.com (James Howard) writes:
>>I think you must have something wrong on your particular
>>version of V.4, or maybe the shell you're running.
>
>My bet would be that "more" was improperly ported,
>and that a "flushing" tty ioctl was used in the port.

No.  There is a bug in SysVr4 streams tty module `ldterm' that flushes
the stream if ICANON is turned on.

This effectively disables typeahead in shells that turn on ICANON when
leaving edit mode (ie ksh in emacs mode).

The fix:

*** ldterm.c-	Wed Oct 10 12:39:58 1990
--- ldterm.c	Wed Aug 15 17:30:29 1990
***************
*** 3162,3168 ****
--- 3162,3170 ----
  		 */
  		if (tp->t_modes.c_lflag & ICANON) {
  			DEBUG4 (("CHANGING TO CANON MODE\n"));
+ #ifdef FLUSH_IF_ICANON_TWEAKED
  			(void) putctl1(q->q_next, M_FLUSH, FLUSHR);
+ #endif
  			optbuf.so_flags = SO_READOPT|SO_MREADOFF;
  			optbuf.so_readopt = RMSGN;
  



More information about the Comp.unix.questions mailing list