BSD ioctl question

John E. Davis davis at pacific.mps.ohio-state.edu
Tue Apr 9 19:56:35 AEST 1991


Hi,

  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?

Currently I have:
{          .
          .
          .

#define TTY_DESCR 2
extern int ioctl(int, int, ...);

#include <sgtty.h>
struct sgttyb   OLDTTY;

          .
          .

void init_io()
{          
    struct sgttyb newtty;

    ioctl(TTY_DESCR, TIOCGETP, &OLDTTY);
    newtty = OLDTTY;
    newtty.sg_flags |= CBREAK;  
    newtty.sg_flags &= ~(ECHO | XTABS);
    
    ioctl(TTY_DESCR, TIOCSETP, &newtty);
}

Here I use CBREAK mode but I want to allow all input characters to pass
through unprocessed and I want output processing.  What are the necessaary
changes?  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..).  In BSD, how do I accomplish this with an ioctl?

Thanks,      
--
John

  bitnet: davis at ohstpy
internet: davis at pacific.mps.ohio-state.edu



More information about the Comp.unix.programmer mailing list