BSD ioctl question

Chris Torek torek at elf.ee.lbl.gov
Tue Apr 9 21:31:25 AEST 1991


In article <DAVIS.91Apr9055635 at pacific.mps.ohio-state.edu>
davis at pacific.mps.ohio-state.edu  (John E. Davis) writes:
>I [want] to read [an arbitrary 8 bit data] character ... from, say,
>file descriptor 2.  Raw [mode would work except that it] turns off all
>input/output processing. ... I only want input processing turned off.

>from within a C program how do I accomplish the above objective?

>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..).  In BSD, how do I accomplish this with an ioctl?

In BSD, you start by reading about termios.  If you have `stty -isig'
you have POSIX termios.

In general, you want CS8 (8 data bits), optional parity, ISIG and ICANON
turned off, and OPOST turned on.

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', CBREAK in the sgtty flags, and also
turning off all the special characters (struct tchars, struct ltchars).
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427)
Berkeley, CA		Domain:	torek at ee.lbl.gov



More information about the Comp.unix.programmer mailing list