CBREAK on Interactive Unix 2.2

Guy Harris guy at auspex.auspex.com
Fri Jan 25 08:05:08 AEST 1991


>		new.c_lflag &= ~ECHO;
>		new.c_lflag &= ~ICANON;
>		new.c_lflag &= ~ISIG;

...

>Thus, using cbreak(1) would put the terminal into cbreak mode,

And also turn off echoing and processing of signal characters such as
the interrupt and quit characters, which turning CBREAK mode on, in
systems with that mode, won't do.

CBREAK, in systems that have it (well, in systems that have a V7-style
CBREAK, and not some Mutant CBREAK From Hell), is the inverse of ICANON
on systems that have it; turning CBREAK on is equivalent to turning
ICANON off, setting c_cc[VMIN] to 1, and setting c_cc[VTIME] to 0, but
leaving ECHO and ISIG alone.

In practice, lots of programs that turn CBREAK mode on also want to turn
echoing and the signal characters off, but not all do (most probably
turn echoing off, but many may not turn the signal characters off), so
the function in question may be what he wants - but it's not
*necessarily* what he wants, as the program may really want the
interrupt character to cause a SIGINT.



More information about the Comp.unix.questions mailing list