setting cbreak/noecho under system V.2

rcodi at goanna.UUCP rcodi at goanna.UUCP
Fri Jul 18 13:05:45 AEST 1986


> #define crmode() 	(_tty.c_lflag &=~ICANON, _tty.c_cc[VMIN] = 1,\
> 				_tty.c_cc[VTIME] = 1,\
> 				ioctl(_tty_ch,TCSETAF,&_tty))

> The problem is that when I use the macros, I get logged out.  I assume
> because my tty "speed" is set to 0 (hangup).  

I suppose this is a silly question, but did you ioctl(_tty_ch, TCGETA, &_tty)
before you used these macros?  If you didn't, then the _tty structure
would be all zeros if it is static, or all garbage if it is stack resident.

You should also save VMIN and VTIME values in crmode(), and restore
them in nocrmode() as they overlay EOF and EOL in the termio structure.
If you don't, then your EOF and EOL characters will be incorrect in nocrmode().

It might be better to write routines rather than macros to do this properly.

Ian Donaldson



More information about the Comp.unix.wizards mailing list