Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 (MC830713); site edai.UUCP Path: utzoo!linus!philabs!cmcl2!floyd!vax135!ukc!edcaad!edee!edai!ok From: ok@edai.UUCP (Richard O'Keefe) Newsgroups: net.wanted Subject: Using the Sys III tty driver Message-ID: <4127@edai.UUCP> Date: Tue, 10-Apr-84 19:53:43 EST Article-I.D.: edai.4127 Posted: Tue Apr 10 19:53:43 1984 Date-Received: Fri, 13-Apr-84 01:42:57 EST Organization: Art.Intelligence,Edin.Univ. Lines: 18 I'm looking for help on this particular one. What I want is a replacement for the EUUG V7 TIOCEMPTY ioctl() or the 4.?bsd FIONREAD ioctl(). That is, most of the time I want read(fd, &c, 1) to wait until there is a character, while occasionally I want to check if there is a character there, and I don't want to read it. Switching off ICANON and setting MIN = TIME = 0 lets me check if there is a character in the input queue by trying to read it; if there isn't one read() returns 0, if there is one read() returns 1 and I have to stash the character away and check for it every time I read from the terminal or check for input, which is a pain, but I can live with it. However, that interferes with the other read() calls where I want TIME=0 but MIN=1. Is there any easy way of checking for input in Sys III or do I have to do three system calls (an ioctl() to set MIN=0, a read(), and another ioctl() to set MIN=1 again)?