Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!uflorida!haven!adm!xadmx!moss@BRL.MIL From: moss@BRL.MIL (VLD/VMB) Newsgroups: comp.unix.questions Subject: Re: tail -f Message-ID: <17785@adm.BRL.MIL> Date: 13 Dec 88 03:34:56 GMT Sender: news@adm.BRL.MIL Lines: 17 >>I suppose it could use select(2)... > >You suppose incorrectly. I know of no UNIX system where "select" will >permit you to wait for a regular file (as in S_IFREG) file to be >modified.... Right, he was probably referring to a non-blocking read which won't help since blocking is really what you want. Anyway, I haven't looked at the source for 'tail', but I wrote an asynchronous log file monitoring subroutine to allow the contents of an interactive program's log file to be displayed in a scrolling window. A subroutine gets called from an alarm signal handler which loops on fgets() until one fails, then does a clearerr() (only necessary on some systems like 4.2 BSD) to clear the EOF condition. Then, the signal handler resets the alarm for N seconds. Of course you can use sleep() instead of the alarm() call/handler if you want. -moss