[comp.unix.xenix] TIOCSTI and FIONREAD

petur@kopasker.is (Petur Thorsteinsson) (01/14/89)

I'm compiling a program, originally written for 4BSD, on Xenix 2.2.2.
TIOCSTI and FIONREAD (from sgtty.h) are used as arguments for
ioctl() in the program. ( ioctl(0,TIOCSTI,"\n") and ioctl(0,FIONREAD,&nc))

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?  

Any other solution?

All help appreciated very much. 

..........................................................................
Petur Thorsteinsson                         /                            /
(The Primary school of Kopasker, Iceland)   /   Don't shoot the pianist. /
                                            /   He's doing his best.     /
petur@kopasker.is OR petur@rhi.hi.is        /                            /
..........................................................................

dyer@spdcc.COM (Steve Dyer) (01/15/89)

In article <63@kopasker.is> petur@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@ursa-major.spdcc.com aka {ima,harvard,rayssd,linus,m2c}!spdcc!dyer
dyer@arktouros.mit.edu