Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ames!pacbell!att!chinet!les From: les@chinet.UUCP (Leslie Mikesell) Newsgroups: comp.unix.wizards Subject: Re: How can I read keyboard without stopping Message-ID: <6630@chinet.UUCP> Date: 19 Sep 88 17:00:08 GMT References: <813@ms3.UUCP> <1246@mcgill-vision.UUCP> <669@super.ORG> <690@super.ORG> <1305@mcgill-vision.UUCP> <717@super.ORG> <12587@ncoast.UUCP> Reply-To: les@chinet.UUCP (Leslie Mikesell) Organization: Chinet - Public Access Unix Lines: 20 In article <12587@ncoast.UUCP> allbery@ncoast.UUCP (Brandon S. Allbery) writes: >...unless the pipe is really a FIFO, in which case the EOF is (again) >temporary. (That's how it seemed to work under SVR2, at least. I would >have preferred that the call block until someone else opened the other end >of the FIFO and wrote to it, though, for the application I was trying to >write with FIFOs. It made the program work like it was in NDELAY mode. I >finally ended up using message queues.) If you do not set NDELAY on a FIFO, the first read will block until something is available, and the last close will make subsequent reads return EOF until another process opens the FIFO for output. If you want the reading process to always block when no data is available, just have it open the FIFO for write access (but don't write anything). I use this trick to connect shell scripts to FIFOs so I can periodically echo commands at them. If I want the script to be able to continue with something else when no command is present, I don't open it for writing. This is handy since you can't fcntl() from a shell script but it would be nice if there were better documentation about FIFOs. Les Mikesell