[comp.unix.questions] Accessing the tty structure.

Conrad.Bullock@comp.vuw.ac.nz (Conrad Bullock) (09/28/90)

I'm trying to port a locally written BBS package to an AT&T 3B2/400,
running Sys V Rel 3.0. The package was originally written under SCO
Xenix, and it made use of the rdchk() system call, to determine if
there were any characters waiting to be read.  I thought of the
FIONREAD ioctl, but that's not there. I got around the problem by
switching input to O_NDELAY mode, and using read to determine how many
characters were ready, but performance suffered considerably.

I'd like to switch back to blocking I/O, and be able to determine if
there are characters waiting to be read. I noticed that the internal
tty structure would allow me to determine this - I know that this
would be horribly unportable, but I don't care - I'd just like to get
it working under this Sys V 3.0 system.

Now - my question is - how can I get at the tty structure for the
current input terminal, so I can get at the info I'm after?

Thanks,


-- 
Conrad Bullock                     | Domain:   conrad@comp.vuw.ac.nz
Victoria University of Wellington, |     or:   conrad@actrix.co.nz
New Zealand.                       | Fidonet:  3:771/100
                                   | BBS:      The Cave BBS +64 4 643429