Path: utzoo!attcan!uunet!lll-winken!ames!haven!uflorida!gatech!bbn!spdcc!dyer From: dyer@spdcc.COM (Steve Dyer) Newsgroups: comp.unix.xenix Subject: Re: TIOCSTI and FIONREAD Message-ID: <2419@spdcc.SPDCC.COM> Date: 14 Jan 89 17:01:48 GMT References: <63@kopasker.is> Reply-To: dyer@ursa-major.spdcc.COM (Steve Dyer) Organization: S.P. Dyer Computer Consulting, Cambridge MA Lines: 28 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