Path: utzoo!attcan!uunet!lll-winken!csd4.milw.wisc.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!BRL.MIL!moss From: moss@BRL.MIL ("Gary S. Moss", VLD/VMB) Newsgroups: comp.sys.sgi Subject: Re: Achieving CBREAK without Curses Message-ID: <8907240944.aa09661@VMB.BRL.MIL> Date: 24 Jul 89 13:44:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 32 Under System V, you should be using the termio structure rather than sgtty. The way to simulate CBREAK mode would be to turn canonical input processing OFF, and set up the VMIN and VTIME flags to 1 and zero respectively. Below is an excerpt from a library of mine which works on both BSD and SYSV, I have stripped out the BSD stuff for this example, and it is incomplete, but you should get the idea. The library is part of BRL CAD (libtermio), but if you don't have it and want just the library, send me a note, it is only a few pages of sources. -moss #include struct termio tio; /* clrCbreak() -- turn CBREAK mode off */ clrCbreak() { tio.c_lflag |= ICANON; /* Canonical input ON. */ tio.c_cc[VEOF] = 4; /* Defaults! Best we can do.... */ tio.c_cc[VEOL] = 0; (void) ioctl( 0, TCSETA, &tio ); } /* setCbreak() -- turn CBREAK mode on */ setCbreak() { tio.c_lflag &= ~ICANON; /* Canonical input OFF. */ tio.c_cc[VMIN] = 1; tio.c_cc[VTIME] = 0; (void) ioctl( 0, TCSETA, &tio ); }