use of SGTTY.H and stuff involving IOCTLs
"Gary S. Moss", VLD/VMB
moss at BRL.MIL
Thu Dec 21 01:49:15 AEST 1989
Dave Ciemiewicz has got the right idea, but based on some of my code that
seems to work I would make some changes. I already sent some code to Thomas,
but for the benefit of other readers, take this for what its worth:
< For instance, your code should be something like:
< #include "termio.h"
< ...
< ioerr = ioctl(fileno(stdin), TCGETA, &tty_orig);
< ...
< tty_new.c_iflag &= ~ECHO;
It is my impression that turning off echo is an orthogonal operation, not
part of "CBREAK" mode.
< /* CRMOD emulation */
< tty_new.c_iflag &= ~ICRNL;
< tty_new.c_oflag &= ~OCRNL;
Carriage return to newline processing is not disabled in CBREAK mode as
far as I know. Study of tty(4) on my Sun seems to confirm this.
< /* CBREAK or 4.3BSD RAW mode emulation (see termio(7) man page
< ** discussion of ICANON)
< */
< tty_new.c_iflag &= ~ICANON;
That should be:
tty_new.c_lflag &= ~ICANON;
< tty_new.c_cc[VMIN] = 1; /* MIN characters */
< tty_new.c_cc[VTIME] = 1; /* TIME in tenths of seconds */
I set the VTIME field to 0, not sure if it matters, though termio(7)
on my 4D says to set them both to one to simulate BSD RAW mode.
Also, you want to enable signal processing.
tty_new.c_lflag |= ISIG; /* Signals ON. */
More information about the Comp.sys.sgi
mailing list