[comp.sources.bugs] MicroEMACS 3.9e termio.c bug on USG systems

john@jetson.UPMA.MD.US (John Owens) (08/20/88)

On USG systems, MicroEMACS uses TCSETA instead of TCSETAW to change
terminal modes.  This can cause at least two problems when returning
from a spawn:

	1 - Buffered output will be output using the new modes,
	    meaning that carriage returns will not be added to
	    newlines, among other things.

	2 - Since the new modes don't contain ixon, when output is
	    stopped but the buffers drain (in the case of a smart
	    buffered serial card, for example) and the spawn returns
	    to microemacs, there is no way to restart output (since
	    control-Q is no longer accepted), and the terminal is
	    effectively hung.  (This happened to me, and is why I
	    looked for and found the bug.)

Here are context diffs for 3.9e termio.c:

*** /tmp/,RCSt1a03477	Fri Aug 19 17:52:35 1988
--- termio.c	Fri Aug 19 17:51:50 1988
***************
*** 169,175
  	ntermio.c_line = otermio.c_line;
  	ntermio.c_cc[VMIN] = 1;
  	ntermio.c_cc[VTIME] = 0;
! 	ioctl(0, TCSETA, &ntermio);	/* and activate them */
  	kbdflgs = fcntl( 0, F_GETFL, 0 );
  	kbdpoll = FALSE;
  #endif

--- 169,175 -----
  	ntermio.c_line = otermio.c_line;
  	ntermio.c_cc[VMIN] = 1;
  	ntermio.c_cc[VTIME] = 0;
! 	ioctl(0, TCSETAW, &ntermio);	/* and activate them */
  	kbdflgs = fcntl( 0, F_GETFL, 0 );
  	kbdpoll = FALSE;
  #endif
***************
*** 239,245
  #endif
  
  #if	USG
! 	ioctl(0, TCSETA, &otermio);	/* restore terminal settings */
  	fcntl(0, F_SETFL, kbdflgs);
  #endif
  

--- 239,245 -----
  #endif
  
  #if	USG
! 	ioctl(0, TCSETAW, &otermio);	/* restore terminal settings */
  	fcntl(0, F_SETFL, kbdflgs);
  #endif
  
-- 
John Owens		john@jetson.UPMA.MD.US
SMART HOUSE L.P.	uunet!jetson!john		(old uucp)
+1 301 249 6000		john%jetson.uucp@uunet.uu.net	(old internet)