From: gezelter@neon.cchem.berkeley.edu (Dan Gezelter)
Newsgroups: alt.hackers
Subject: .plan pipe to backfinger.
Date: 25 Jan 1993 22:12:36 GMT
Organization: UC Berkeley
Distribution: world
NNTP-Posting-Host: neon.cchem.berkeley.edu

Here's the latest version of the .plan pipe program that I've
inherited from numerous other people.  It was posted to alt.sources a
while back, so somewhere there exists an archive, but I know not
where.  If you modify the code, I'd appreciate some e-mail telling me
what you've done...  I NO LONGER SUPPORT OR RUN THIS CODE.  It was too
slow and annoying to my friends, so I gave up.  Also, Ultrix machines
refuse to print .plans that aren't plain text files.  Don't even try
to run this on an ultrix machine.

YOU MUST MODIFY SOME OF THE SHELL SCRIPTS CONTAINED HEREIN.  They
contain site specific information and will not work without
modification.


-------------CUT HERE----------------
#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  MANIFEST Makefile README backfinger check-plan logfinger
#   plan.c plan.nr start-plan stop-plan
# Wrapped by gezelter@neon.cchem.berkeley.edu on Tue Nov 10 15:03:36 1992
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'MANIFEST'\"
else
echo shar: Extracting \"'MANIFEST'\" \(690 characters\)
sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
XMANIFEST - This file
XMakefile - The makefile
XREADME   - Original notes, notes for first set of changes, and notes
X	   for my changes
Xplan.c   - The program
Xplan.nr  - A man page
Xlogfinger - a sh script that I wrote to figure out remote fingering
X            addresses.  WARNING:  You may need to make some mods
X            to logfinger before it will work for you.
Xbackfinger - a script that logfinger calls to determine who is logged
X             in at the remote address.
Xstart-finger - starts a bunch of plan processes on a cluster of
X               diskless workstations.
Xstop-finger - looks through the .planpid directory and kills all
X              plan processes on remote machines.
END_OF_FILE
if test 690 -ne `wc -c <'MANIFEST'`; then
    echo shar: \"'MANIFEST'\" unpacked with wrong size!
fi
# end of 'MANIFEST'
fi
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(2053 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
XDEST	      = $(HOME)/bin
X
XEXTHDRS	      = /usr/include/fcntl.h \
X		/usr/include/signal.h \
X		/usr/include/stdio.h \
X                /usr/include/dirent.h \
X		/usr/include/sys/fcntl.h \
X		/usr/include/sys/file.h \
X		/usr/include/sys/stat.h \
X		/usr/include/sys/sysmacros.h \
X		/usr/include/sys/sysmacros.h \
X		/usr/include/sys/types.h \
X		/usr/include/sys/types.h
X
XHDRS	      =
X
XLDFLAGS	      =
X
XLIBS	      =
X
XCC            = cc
X
XLINKER	      = cc
X
XMAKEFILE      = Makefile
X
XOBJS	      = plan.o
X
XPRINT	      = pr
X
XPROGRAM	      = plan
X
XSRCS	      = plan.c
X
XLOGGER        = logfinger
X
XBACKER        = backfinger
X
XPLANPID       = $(HOME)/.planpid
X
Xall:		$(PROGRAM) planpid man
X
X$(PROGRAM):     $(OBJS) $(LIBS)
X		@echo -n "Loading $(PROGRAM) ... "
X		@$(LINKER) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM)
X		@echo "done"
X
Xplanpid:;	@if [ -d $(HOME)/.planpid ] ; \
X		then echo "Make sure you copy .plan to .realplan" ; \
X		else \
X			echo "Making .planpid directory" ;\
X			mkdir "$(HOME)/.planpid"  ; \
X			echo  "Make sure you copy .plan to .realplan" ;\
X		fi
X
Xman:;		@nroff -man plan.nr > plan.man
X 
Xclean:;		@rm -f $(OBJS)
X
Xdepend:;	@mkmf -f $(MAKEFILE) PROGRAM=$(PROGRAM) DEST=$(DEST)
X
Xindex:;		@ctags -wx $(HDRS) $(SRCS)
X
Xinstall:	$(PROGRAM) planpid man
X		@echo Installing $(PROGRAM) in $(DEST)
X		@cp $(PROGRAM) $(DEST)/$(PROGRAM)
X		@strip $(DEST)/$(PROGRAM)
X		@echo Installing $(LOGGER) in $(DEST)
X		@cp $(LOGGER) $(DEST)/$(LOGGER)
X		@echo Installing $(BACKER) in $(DEST)
X		@cp $(BACKER) $(DEST)/$(BACKER)
X
Xprint:;		@$(PRINT) $(HDRS) $(SRCS)
X
Xprogram:        $(PROGRAM)
X
Xtags:           $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS)
X
Xupdate:		$(DEST)/$(PROGRAM) $(DEST)/$(LOGGER) $(DEST)/$(BACKER)
X
X$(DEST)/$(PROGRAM): $(SRCS) $(LIBS) $(HDRS) $(EXTHDRS)
X		@make -f $(MAKEFILE) DEST=$(DEST) install
X###
Xplan.o: /usr/include/sys/types.h /usr/include/sys/sysmacros.h \
X	/usr/include/sys/sysmacros.h /usr/include/sys/file.h \
X	/usr/include/sys/types.h \
X	/usr/include/fcntl.h /usr/include/stdio.h /usr/include/sys/stat.h \
X	/usr/include/signal.h /usr/include/dirent.h
END_OF_FILE
if test 2053 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(6800 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
XAll I did was modify Karen's code so that it puts the pid
Xfiles in the ~/.planpid directory.  The actual pid files
Xtake the hostname of the machine that plan is running on 
Xand reside in that directory.  This was necessary to have
Xplan working on a cluster of diskless workstations (which
Xneed a new named pipe for each machine).  To get that to
Xwork, you need to soft link ~/.plan to /tmp/.plan and then
Xrun plan -f /tmp/.plan yourprogram.  This creates a named
Xpipe on each machine in a subdirectory that that machine
Xcan use named pipes on.  The soft link points to the
Xright place no matter which machine it is, but you need
Xa new planpid file for each host.  
X
XI also replaced logfinger with a faster and pretty nifty
Xsh script that figures out the IP address and hostname of
Xsomeone that is remotely fingering you.  You're may
Xhave to make some major mods to this before it will work
Xfor you.  What would be really cool is if someone can get
Xlogfinger to figure out all the relevant details *no matter
Xwhere* you are being fingered from. (local or remote) Anyone
Xhave any ideas?
X
XDan   (gezelter@lithium.cchem.berkeley.edu)
X
X
XAll I did was to put in a function that keeps track of the PID for
Xplan by writing it to a file called ".planpid" in your home directory.
XNow you run plan in your .login, and, to kill the process when you log
Xout, put something like this in your .logout:
X
X	kill `cat /home/mine/.planpid`
X	rm -f /home/mine/.planpid
X
XYou have to remove the .planpid (or modify the code), because the 
Xprogram will not run if a plan is already running, which it assumes
Xwhen it finds a .planpid file already there.
X
XIf someone wanted to run multiple plans, maybe one for a .signature
Xand another for a .plan, the save name for the PID could be changed,
Xand the program compiled twice (the binary is not that big, ~40K on
Xthe HP 425's I used), or, if someone is really motivated, they could
Xadd a command line argument for the save name.
X
XSure, my modification isn't very complex, but it does what I needed
Xit to do, and maybe someone else can use it.
X
XKaren	(napalm@ugcs.caltech.edu)
X
X****  Additions by Geoff Loker ****
X
XI have modified Tony Rems' code for plan a bit to get rid of the
Xnecessity for hard-coding in the file name to be set up as a FIFO.
XThe program will now accept an optional argument that specifies the
Xname of the FIFO to be used.  If that argument is not set, the default
XFIFO is $HOME/.plan.
X
XIn order to use this program, your O/S needs to support named pipes.
XYou also need to link in getopt for the changes to work.
X
XAny executable program can be set up to run when the specified FIFO is
Xopened, but don't forget that the program you specify to run is being
Xrun under your userid.
X
X****  Original README ****
X
XDate: Thu, 11 Apr 91 14:09:10 MST
XFrom: Jim Armstrong <armstron@cs.arizona.edu>
XSubject: RE: fingeree ...
X
X> >About a month ago there was a sample program posted to this newsgroup that
X> >set up a FIFO named pipe as your .plan file.  I modified the code to set up
X> >a simple (perhaps naive) finger monitor for users on my machine.  The process
X> do you still have the source for it? would you send it to me?
X
XHere is the article which appeared in comp.unix.questions a while back.  It
Xcontains generic code that will run any program you want whenever a certain
Xfile is accessed (i.e. the .plan file in this case).  All you have to do is
Xcompile it (it creates an executable called 'plan') and then to get it
Xrunning say 'plan a.out &' where a.out is some program you have written.
XI don't have my program any more, but basically what I did was a ps au
Xwithin that program.  It used egrep to search for someone currently fingering
Xme and appended the output to a file.  To get really fancy you could then
Xread from that file to find out exactly who it is (all in the same program)
Xand print out a nice personal message to whoever is fingering you as part
Xof what looks to be your .plan file.  A couple of things to watch out for:
XIf the finger is remote, the ps au won't find anything.  Also, if two people
Xfinger you at the same time you may run into trouble, but I didn't try
Xexperimenting with this too much.  I also found it helpful to timestamp a
Xdate to the file, too (I used localtime() for efficiency).  This makes it
Xeasier to look back later at the file and see who's been fingering you and
Xwhen while you were not logged on.  It also helpful in debugging your program.
X
XSo set up this code and experiment with different programs.  Just be creative
Xand see what else you can do with it.  One idea I used for a while is making
Xit print a different quote each time.  The possibilites are endless.  Enjoy.
X
XJim
X
X
XArticle 31270 of comp.unix.questions:
XFrom: rembo@unisoft.UUCP (Tony Rems)
XNewsgroups: comp.unix.questions
XSubject: Re: Finger
XDate: 22 Feb 91 02:44:17 GMT
XReply-To: rembo@unisoft.UUCP (Tony Rems)
XOrganization: UniSoft Corporation -- UNIX R Us.
X
XIn article <37675@netnews.upenn.edu> minzhi@eniac.seas.upenn.edu (Min-Zhi Shao) writes:
X>
X>    When I fingered our system administrator, I got the following result:
X>
X>_________________________________________________________________________
X>Login name: gardella  			In real life: Ed Gardella [CETS]
X>Directory: /home/cets/gardella      	Shell: /usr/local/bin/bash
X>On since Feb 15 19:49:04 on ttyp1 from TSTEST.SEAS.UPEN
X>14 minutes Idle Time
X>No unread mail
X>Project: System Administrator eniac.seas.upenn.edu
X>Plan:
X>         Meander about until something interesting comes along.
X>
X>Office: 154 Moore Building           Work Phone: 898-2491
X>                                     Home Phone: 387-4104
X>
X>I have been fingered 3 times today
X>_________________________________________________________________________
X>
X>the .plan file in his home directory looks like:
X>
X>prw-r--r--  1 gardella        0 Feb 15 23:48 /home/cets/gardella/.plan
X>^
X
XAs you have found out by now, I'm sure, the p means that this is 
Xa named pipe aka a FIFO.  If you'd like to do this yourself, here
Xis a little program I wrote to do it (see the comments at the
Xthe beginning of the plan.c file for usage info):  
X
XHere's the shar of my plan program, just cut up until it says
X"cut here", and then type 'sh filename' using whatever filename
Xyou save it as.  If you use 'plan' it will get overwritten.
X
XThe code here should compile w/o any problems on any BSD machine,
XI have tried it on a Sun, Vax 750, and Pyramid 90x.  It should
Xalso work properly on any SVR4.0 machine.  
X
XThe code is pretty heavily commented so it should be self
Xexplanatory.  
X
XNote that you should put a -DFILENAME="your_home_dir/.plan"
Xto get it to put your path in, or you can just edit the 
Xsource and change the value of FILENAME permanently.  
X
XIf you have any problems getting it compiled, just send me mail.
X
XEnjoy.  
X
X-Tony
X
END_OF_FILE
if test 6800 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'backfinger' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'backfinger'\"
else
echo shar: Extracting \"'backfinger'\" \(316 characters\)
sed "s/^X//" >'backfinger' <<'END_OF_FILE'
X#!/bin/sh
X
X# Store the fingering info in .fingerees and finger the remote
X# host to find out who fingered us.  This is done in a separate
X# shell in order to avoid printing those damned [pid] messages
X# to the other machine.
X
Xecho "Remote Host $1 ($2) at `date`" >> $HOME/.fingerees
Xfinger @$2 >> $HOME/.fingerees &
END_OF_FILE
if test 316 -ne `wc -c <'backfinger'`; then
    echo shar: \"'backfinger'\" unpacked with wrong size!
fi
chmod +x 'backfinger'
# end of 'backfinger'
fi
if test -f 'check-plan' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'check-plan'\"
else
echo shar: Extracting \"'check-plan'\" \(207 characters\)
sed "s/^X//" >'check-plan' <<'END_OF_FILE'
X#!/bin/sh
XClients=`ls /home/miller/gezelter/.planpid`
Xecho $Clients
Xfor i in $Clients; do
X   thisHost=$i
X   thisPid=`cat $HOME/.planpid/$i`
X   echo $thisHost $thisPid
X   rsh $i "ps aux | grep $thisPid"
Xdone
END_OF_FILE
if test 207 -ne `wc -c <'check-plan'`; then
    echo shar: \"'check-plan'\" unpacked with wrong size!
fi
chmod +x 'check-plan'
# end of 'check-plan'
fi
if test -f 'logfinger' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'logfinger'\"
else
echo shar: Extracting \"'logfinger'\" \(1184 characters\)
sed "s/^X//" >'logfinger' <<'END_OF_FILE'
X#!/bin/sh
X
X# These commands get the hostname and IP address of the machine 
X# that is talking to us over port 79 (the finger port).
X
XHost=`netstat | sed -n -e "s/\.[0-9][0-9]* [ ]*EST.*//" -e "s/.*fing[e]*[r]* [ ]*//p"`
XIP=`netstat -n | sed -n -e "s/\.[0-9][0-9]* [ ]*EST.*//" -e "s/.*\.79 [ ]*//p"`
X
X# These lines check to see if I am logged in from home in order to
X# inform less experienced people which port to use for talk.
X
Xif [ -r $HOME/.rem.tty ]
Xthen
X   mytty=`cat $HOME/.rem.tty`
Xelse 
X   mytty=""
Xfi
X
X# These lines are self-explanatory.
X
XthisHost=`hostname`
XtheDate=`date`
X
X# and this one should be changed to whatever your workstation is...
X
XmyWS="magnesium.cchem.berkeley.edu"
X
X$HOME/bin/backfinger $Host $IP
X
X# Print out the expected finger information and give some interesting info.
X
Xcat $HOME/.realplan
Xecho _________________________________________________________________________
Xecho "You are fingering me from $Host ($IP)  Who are you?" 
Xecho To talk to me, use \"talk $USER\@$myWS $mytty\"
Xecho _________________________________________________________________________
Xecho "$thisHost :  Fingering from $Host ($IP) on $theDate" | \
X      /usr/lib/sendmail $USER
END_OF_FILE
if test 1184 -ne `wc -c <'logfinger'`; then
    echo shar: \"'logfinger'\" unpacked with wrong size!
fi
chmod +x 'logfinger'
# end of 'logfinger'
fi
if test -f 'plan.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'plan.c'\"
else
echo shar: Extracting \"'plan.c'\" \(5725 characters\)
sed "s/^X//" >'plan.c' <<'END_OF_FILE'
X/*	THIS IS THE UNPUBLISHED SOURCE CODE OF REMBO		*/
X/*	The copyright notice above does not evidence any   	*/
X/*	actual or intended publication of such source code.	*/
X/*	So, use it if you like, but give me credit.		*/
X
X
X/* 	Usage: plan [-f file_name] program_name			*/
X
X
X/*	Description:					*/
X
X/* 	This program takes the full pathname of an	*/
X/* 	executable and runs it on a fifo in the 	*/
X/*	user's home directory named .plan.  This	*/
X/* 	way, when finger is executed, the output	*/
X/* 	of the program goes to the fifo.		*/
X	
X/*	Written by:  Tony Rems 				*/
X
X/* 	Send bugs and flames to /dev/null or 		*/
X/* 	rembo@unisoft.com 				*/
X
X/*	Modifications:					*/
X
X/*	September 1991					*/
X/*           (by Geoff Loker geoff@mdms.moore.com)	*/
X/*	Modified the program so that the path to the    */
X/*	.plan file is not hardcoded in.  Now any number	*/
X/*	of users can use the program at the same time.	*/
X/*	I also modified the program to use an optional	*/
X/*	argument to specify which file to use.  The	*/
X/*	default file used is still the user's .plan,	*/
X/*	but this can now also be used to set up		*/
X/*	.signatures or any other file the user wants.	*/
X
X/*	Even more modifications				*/
X
X/*	January 1992					*/
X/*	      (by Karen Bruner napalm@ugcs.caltech.edu) */
X/*	Added pid_deal function, so people can stick	*/
X/* 	the program in their .login, and then have it	*/
X/*	killed by their .logout.  Program will not	*/
X/*	run if a .planpid file, the file with the PID	*/
X/*	for plan, already exists in the user's home	*/
X/*	directory.					*/
X
X/*      Yet still more modifications                    */
X
X/*      January 1992                                    */
X/*      (by Dan Gezelter gezelter@lithium.cchem.berkeley.edu) */
X/*      Modified pid_deal function to put the pid       */
X/*      files in a subdirectory called .planpid/        */
X/*      The pid files then take on the name of the      */
X/*      host that plan is running on.   This was        */
X/*      necessary to have plan working on a cluster     */
X/*      of diskless workstations.                       */
X
X#include <sys/types.h>
X#include <sys/file.h>
X#include <stdio.h>
X#include <fcntl.h>
X#include <sys/stat.h>
X#include <signal.h>
X#include <string.h>
X#include <dirent.h>
X
X/* Defines */
X#define PERMS 0666
X#define USAGE "%s [-f file_name] program_name\n"
X
X/* Function prototypes */
Xvoid sig_handler();
Xint pid_deal();	
X
Xmain (argc, argv)
Xint argc;
Xchar *argv[];
X{
X        int c, fflg;
X	char *file;
X        extern char *optarg;
X	extern int optind;
X	int fd;
X	int pid;
X	int status;
X	char *getenv(), *home, plan[256], *strcat(), *strcpy();
X	int pid_check;
X	
X	fflg = c = 0;
X	while ((c = getopt(argc, argv, "f:")) != EOF) {
X	  file = optarg;
X	  fflg++;
X	}
X
X/* Comment out the next line if you don't want to have PID recorded
X   to file .planpid */
X
X	pid_check = pid_deal(); /* check for .planpid, if none, write
X				   .planpid */
X
X/* Uncomment next line if you commented out previous line */
X
X/*  pid_check = 1; */
X
X  if (pid_check == 1)  /* execute remaining part of program if .planpid
X			  does not exist, i.e., no other plan process is
X			  running */
X    {
X	if (fflg)
X	  strcpy(plan, file);
X	else {
X	  home = getenv("HOME");
X	  strcpy(plan, home);
X	  strcat(plan, "/.plan");
X	}
X/*	setenv("PLAN", plan, 1); */
X
X	if ( argc != optind + 1 ) {
X		fprintf (stderr, USAGE, argv[0]);
X		exit(1);
X	}  /* if */
X
X/* Catch interrupts for cleanup */
X	signal(SIGTERM, sig_handler);
X	signal(SIGINT, sig_handler);
X	signal(SIGHUP, sig_handler);
X
X	unlink (plan);
X
X/* Make the fifo */
X	if ((mknod(plan, S_IFIFO | PERMS, 0)) < 0 ) {
X		perror("mknod");
X		exit(2);
X	}  /* if */
X
X	while (1) {
X		if ((fd = open(plan, O_WRONLY)) < 0 ) {
X			perror("open");
X			exit(3);
X		} /* if */
X
X/* Once our open completes we know that someone else has
X * opened the FIFO for reading, so we can know run our 
X * program on it.  So, we fork, exec our program and
X * wait for the child to complete.
X */
X		switch (pid = fork()) {
X			case -1:
X				perror("fork");
X				exit(4);
X				break;
X			case 0:
X/* If we're in the child, we copy our fifo to stdout */
X/* and exec the program given */
X				dup2(fd, 1);
X				execlp(argv[optind],argv[optind],(void *)NULL);
X				perror("child returned");
X				exit(5);
X				break;
X			default:
X/* If we're in the parent, we close the pipe and wait */
X				close(fd);
X				while (wait(&status) != pid)
X					;
X				break;
X		} /* switch */
X		sleep(2);
X		close(fd);
X	} /* while */
X    }  /* end of my if (pid_check... */
X
X  else
X    printf("plan already running\n");
X
X} /* main */
X
Xvoid sig_handler()  /* cleanup */
X{
X	char *plan, *getenv();
X	
X	plan = getenv("PLAN");
X
X	unlink(plan);
X	exit(0);
X}
X
Xint pid_deal()	/* function for recording pid and making sure process
X		   isn't already running */
X{
X  char savepid[100];	/* string for file name */
X  FILE *sp;
X  int checker;		/* return value:  0 if .planpid exists, and
X			   program shouldn't be run, 1 if not */
X  char *home;
X  char *host[64];
X  int namelen;
X  namelen = 64;
X
X  home = getenv("HOME");		/* put save name for file */
X  gethostname(host,namelen);            /* and host id */
X  strcpy(savepid, home);		/* in savepid */
X  strcat(savepid, "/.planpid/");
X  strcat(savepid, host);
X
X  if ((sp = fopen(savepid, "r")) != NULL) /* test for existence of 
X					     .planpid by trying to open
X					     the file for reading */
X    checker = 0; 	/* return a zero if read was successful, i.e.,
X			   file already exists */
X	
X  else
X    checker = 1;	/* file doesn't exist, return a 1 to execute
X			   the rest of the program */
X  fclose(sp);
X
X  if (checker == 1)
X    {
X      sp = fopen(savepid, "w");
X      fprintf(sp, "%d", getpid()); 	/* puts PID for plan into file */
X      fclose(sp);
X    }
X
X  return checker;
X} 
END_OF_FILE
if test 5725 -ne `wc -c <'plan.c'`; then
    echo shar: \"'plan.c'\" unpacked with wrong size!
fi
# end of 'plan.c'
fi
if test -f 'plan.nr' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'plan.nr'\"
else
echo shar: Extracting \"'plan.nr'\" \(1581 characters\)
sed "s/^X//" >'plan.nr' <<'END_OF_FILE'
X.TH PLAN L "\*(V)" "4BSD"
X.SH NAME
Xplan - run an executable when a specified FIFO is opened
X.SH SYNOPSIS
X.B plan
X[
X.BR -f file
X]
X.B executable
X.SH DESCRIPTION
X.I plan
Xtakes the name of an executable program and runs it on a FIFO that
Xis specified on the command line or on a FIFO in the user's home directory
Xnamed .plan.  Whenever the FIFO is accessed, the output of the executable
Xprogram goes to the FIFO.  It also writes the PID of plan to a file, so
Xthe process can be killed during logout, and it checks for the existence
Xof this file to make sure plan isn't already running.
X.SH OPTIONS
X.TP
X.B \-f file_name
XThe \fB\-f flag causes \fIplan\fR to set up the specified \fBfile_name\fR
Xas a FIFO rather than the default \fB$HOME/.plan\fR.
X.PP
XSome sample uses of \fIplan\fR would be:
X.TP
X.B plan /usr/games/fortune &
XThis will display a randomly selected fortune as the contents of
Xyour .plan file whenever you are fingered.
X.TP
X.B plan -f ~/.signature ~/bin/gensig &
XThis will run the program gensig whenever your .signature file is accessed,
Xallowing you to change your .signature whenever you post.
X.TP
X.B plan ~/bin/logfinger &
XThis will run the program logfinger whenever your .plan file is accessed,
Xand you can log all instances of people fingering you.
X.SH AUTHOR
XTony Rems (rembo@unisoft.com)
X.PP
XModifications by Geoff Loker (geoff@mdms.moore.com)
X.PP
XMore modifications by Karen Bruner (napalm@ugcs.caltech.edu)
X.PP
XEven more modifications by Dan Gezelter (gezelter@lithium.cchem.berkeley.edu)
X.SH BUGS
XYour system must support named pipes in order for this to work.
END_OF_FILE
if test 1581 -ne `wc -c <'plan.nr'`; then
    echo shar: \"'plan.nr'\" unpacked with wrong size!
fi
# end of 'plan.nr'
fi
if test -f 'start-plan' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'start-plan'\"
else
echo shar: Extracting \"'start-plan'\" \(521 characters\)
sed "s/^X//" >'start-plan' <<'END_OF_FILE'
X#!/bin/csh
Xset Clients = `ypcat ethers | awk '{print $2}'`
Xset AllHosts = "$Clients lithium"
Xecho $AllHosts
X/bin/mv $HOME/.login $HOME/.login.sv
X/bin/mv $HOME/.logout $HOME/.logout.sv
X/bin/mv $HOME/.cshrc $HOME/.cshrc.sv
Xecho "~/bin/plan -f /tmp/.plan ~/bin/logfinger &" > $HOME/.login
Xecho logout >> $HOME/.login
Xchmod 744 $HOME/.login
Xforeach i ($AllHosts)
X   echo $i
X   rlogin $i
Xend
X/bin/rm $HOME/.login
X/bin/mv $HOME/.login.sv $HOME/.login
X/bin/mv $HOME/.logout.sv $HOME/.logout
X/bin/mv $HOME/.cshrc.sv $HOME/.cshrc
END_OF_FILE
if test 521 -ne `wc -c <'start-plan'`; then
    echo shar: \"'start-plan'\" unpacked with wrong size!
fi
chmod +x 'start-plan'
# end of 'start-plan'
fi
if test -f 'stop-plan' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'stop-plan'\"
else
echo shar: Extracting \"'stop-plan'\" \(221 characters\)
sed "s/^X//" >'stop-plan' <<'END_OF_FILE'
X#!/bin/sh
XClients=`ls /home/miller/gezelter/.planpid`
Xecho $Clients
Xfor i in $Clients; do
X   thisHost=$i
X   thisPid=`cat $HOME/.planpid/$i`
X   echo $thisHost $thisPid
X   rsh $i kill $thisPid
Xdone
X/bin/rm $HOME/.planpid/*
END_OF_FILE
if test 221 -ne `wc -c <'stop-plan'`; then
    echo shar: \"'stop-plan'\" unpacked with wrong size!
fi
chmod +x 'stop-plan'
# end of 'stop-plan'
fi
echo shar: End of shell archive.
exit 0
-------------CUT HERE--------------
-- 
_________________________________________________________________________
Don't step on my blue suede .sig      gezelter@lithium.cchem.berkeley.edu
-------------------------------------------------------------------------
Newsgroups: alt.hackers