Path: utzoo!censor!geac!torsqnt!hybrid!scifi!bywater!uunet!bria!mike Newsgroups: comp.unix.questions Subject: Re: CBREAK on Interactive Unix 2.2 Message-ID: <381@bria> Date: 23 Jan 91 01:21:53 GMT References: <1991Jan21.035008.14489@ncs.dnd.ca> Reply-To: bria!mike (Michael Stefanik) Organization: Briareus Corporation, Los Angeles, CA Lines: 49 In an article, ncs.dnd.ca!marwood (Gordon Marwood) writes: >I shall shortly be transferring from a MicroVAX Ultrix system to one >using Interactive Unix 2.2. In preparation for this I am transfering a >number of programs over to the new system. One of these uses CBREAK in >a function which changes mode to allow "hot-key" interaction by the user. >The Interactive C compiler cannot seem to find CBREAK, and generates an >error. Any assistance to solve this problem would be appreciated. The only cbreak function that I'm aware of is in curses(3); if you need the equivalent without using curses, here ya' go: #include int cbreak(mode) int mode; { static struct termio old, new; int oncethru = 0, israw = 0; if ( ! oncethru ) { ioctl(0,TCGETA,&old); ioctl(0,TCGETA,&new); oncethru = 1; } if ( mode && (! israw) ) { new.c_lflag &= ~ECHO; new.c_lflag &= ~ICANON; new.c_lflag &= ~ISIG; new.c_cc[VMIN] = 1; new.c_cc[VTIME] = 0; ioctl(0,TCSETA,&new); } else { ioctl(0,TCSETA,&old); israw = 0; } } Thus, using cbreak(1) would put the terminal into cbreak mode, which will return one character at a time; using cbreak(0) would put the terminal back into canonical mode. -- Michael Stefanik, Systems Engineer (JOAT), Briareus Corporation UUCP: ...!uunet!bria!mike -- technoignorami (tek'no-ig'no-ram`i) a group of individuals that are constantly found to be saying things like "Well, it works on my DOS machine ..."