ok@edai.UUCP (Richard O'Keefe) (04/11/84)
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)?