TIOCSTI and FIONREAD

Steve Dyer dyer at spdcc.COM
Sun Jan 15 03:01:48 AEST 1989


In article <63 at kopasker.is> petur at kopasker.is (Petur Thorsteinsson) writes:
>TIOCSTI and FIONREAD are not defined in the Xenix environment, but there
>is a lot of #defines in sgtty.h, sys/ioctl.h and sys/machdep.h on Xenix.
>The manuals don't have much information on what they do.
>
>Do you think there are some equivalents to TIOCSTI and FIONREAD that I 
>could use instead of them?  

ioctl(fh, TIOCSTI, &ch) places a character on the input queue of the TTY
structure associated with the open file descriptor 'fh', just as if a person
had typed it on the TTY line.

There is nothing to my knowledge which simulates this under XENIX.

int nchars;
ioctl(fh, FIONREAD, &nchars) returns in the interger 'nchars' the number
of characters which can be read from the terminal without blocking.

There is a XENIX system call, empty(fh), which allows a program to peek
at the input queue to determine whether a read will block, but it just
returns a boolean status: when it returns false, you can reliably only try
to read a single character from the TTY before haning to call empty(fh)
again.

-- 
Steve Dyer
dyer at ursa-major.spdcc.com aka {ima,harvard,rayssd,linus,m2c}!spdcc!dyer
dyer at arktouros.mit.edu



More information about the Comp.unix.xenix mailing list