Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.unix.programmer Subject: Re: BSD ioctl question Message-ID: <7114@auspex.auspex.com> Date: 10 Apr 91 18:12:05 GMT References: <11914@dog.ee.lbl.gov> Distribution: comp Organization: Auspex Systems, Santa Clara Lines: 62 In article davis@pacific.mps.ohio-state.edu (John E. Davis) writes: > This is a BSD unix question. I to read a character in RAW mode from, say, >file descriptor 2. Raw turns off all input/output processing. However, I >only want input processing turned off. This is not the same as CBREAK. >CBREAK still does input processing on the special characters ^Z (stop), >^\ (quit), etc... which I want turned off. So my question is this: from >within a C program how do I accomplish the above objective? Well, it depends on what you do, and what you don't, want turned off. It also depends on what flavor of tty driver your OS has; you say "BSD UNIX", but also say >Note: I did RTFM but all it talked about was termio which our system >does not have (although for some stupid reason the man pages think so). > >A related question (perhaps the same question): It seems that from the shell, >I can type `stty -isig' to turn off input processing on the interrupt >characters (^Z, etc..). Given that you can type "stty -isig" from the shell, I'm skeptical of your claim that your system doesn't have "termio", because ISIG is a "termio"ism. The explanations I can think of are: 1) your system has "termios", but not "termio"; 2) your system has picked up some "termio"/"termios"isms, but not others. Precisely what OS are you running? If it's a BSD release prior to 4.3-reno, I'm curious how it got "isig". If it's 4.3-reno, it doesn't have "termio", but it *does* have "termios". >In BSD, how do I accomplish this with an ioctl? Well, if your system really truly genuinely doesn't have "termio" *or* "termios", the way you'd do it would be to go into CBREAK mode *and* "disable" the interrupt characters - and the XON/XOFF characters, if you want them "disabled" as well. To "disable" them, set them to '\377' using the TIOCGETC/TIOCSETC and TIOCGLTC/TIOCSLTC "ioctl"s; "disable" is in quotes because that doesn't really disable them, it merely sets them to a value unlikely to be seen (if you have 8-bit input turned on, they are, at best, unlikely, not impossible; if you have 8-bit input turned off, they are impossible). If your system *does* have "termio" or "termios", then turn ISIG off to disable all the interrupt characters (^C, ^Z, ^\), and turn IXON off to disable the XON/XOFF characters. You may also want to turn IEXTEN off, as that may be necessary to disable the literal-next (^V) and flush-output (^O) characters. In article <11914@dog.ee.lbl.gov> torek@elf.ee.lbl.gov (Chris Torek) writes: >In general, you want CS8 (8 data bits), optional parity, ISIG and ICANON >turned off, and OPOST turned on. Well, I'm not sure he said he wanted 8-bit input.... >If you have a BSD system without `stty -isig' and without TIOCGETA etc., >you can fake 8-bit input without disabling output processing by setting >LLITIN in the `local mode word', Setting *what*? "I see no LLITIN here." Do you mean "PASS8"?