Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!BRL.MIL!moss From: moss@BRL.MIL ("Gary S. Moss", VLD/VMB) Newsgroups: comp.sys.sgi Subject: Re: use of SGTTY.H and stuff involving IOCTLs Message-ID: <8912200949.aa18764@VMB.BRL.MIL> Date: 20 Dec 89 14:49:15 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 33 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. */