[comp.unix.questions] HELP!!

guy@gorodish.Sun.COM (Guy Harris) (11/09/87)

> This could be done more elegently by a call to gtty() and stty() or
> ioctl()
> 
> like this...
> 	/*
> 	**	set flags to turn off echo and
> 	**	character buffering (binary mode)
> 	*/
> 	argp.sg_flags |= RAW;		/* no buffering */
> 	argp.sg_flags &= ~ECHO;		/* and turn off echo */

1) This may work under System V, due to some binary compatibility code, but the
correct way to do it there is to use TCGETA and TCSETA, and to clear the ICANON
and ECHO bits in the "c_lflags" field of the "termio" structure instead.

2) RAW mode is, indeed, binary mode; binary mode is overkill for almost all
applications of this sort.  You want CBREAK mode instead; turning on CBREAK
mode does not disable parity checking and generation, does not disable XON/XOFF
flow control (which may be important on terminals such as VT100s, especially in
smooth-scroll mode), and does not disable the signal-generating characters such
as ^C.
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.com