Doing Interesting Things With .plan

Andrew Choi achoi at cory.Berkeley.EDU
Fri Jan 18 08:16:08 AEST 1991


Hi everyone.  About 2 months ago there were several
programs posted on the net about doing interesting things 
with .plan, namely, they all set up a FIFO pipe and have a
program listening ('select'ing) on the pipe.  If the pipe is
read (as a result of being fingered), the program responds.
However, I couldn't get my program to work!!!  The following is
part of what I have:

-----

loop(FILE *fp)
{
	fd_set	writefds;

	FD_ZERO(&writefds);
	FD_SET(fileno(fp), &writefds);

	select(FD_SETSIZE, NULL, &writefds, NULL, NULL);

	if (FD_ISSET(fileno(fp), &writefds)) {

		/* Write stuff to fp, such as when I was */
		/* last fingered ... etc. */
	}

	fclose(fp);
}

-----

However, the code as it is DOESN'T work because the "select" is
not doing the right thing, namely, it doesn't sleep until the
pipe is filled.  So, what ends up happening is that initially my
program will write out messages to the pipe until it is filled, 
which means that the time I was last fingered will not be correct.

Would some one please enlighten me and tell me how to fix this
problem?  I sincerely thank you in advance.


Name:  Andrew Choi	Internet Address:  achoi at cory.berkeley.edu
Tel:   (415)848-5658
#include <standard/disclaimer.h>



More information about the Comp.unix.programmer mailing list