home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / misc / 4085 < prev    next >
Encoding:
Internet Message Format  |  1992-11-10  |  19.2 KB

  1. Xref: sparky comp.unix.misc:4085 comp.unix.wizards:4588 comp.unix.questions:13195
  2. Newsgroups: comp.unix.misc,comp.unix.wizards,comp.unix.questions
  3. Path: sparky!uunet!news.tek.com!uw-beaver!cs.ubc.ca!utcsri!torn!csd.unb.ca!morgan.ucs.mun.ca!nstn.ns.ca!cs.dal.ca!ug.cs.dal.ca!franklin
  4. From: franklin@ug.cs.dal.ca (Steve Franklin)
  5. Subject: THE SOURCE TO NAMEDP, A FINGER PROGRAM
  6. Message-ID: <BxI77y.K9t@cs.dal.ca>
  7. Sender: usenet@cs.dal.ca (USENET News)
  8. Nntp-Posting-Host: ug2.cs.dal.ca
  9. Organization: Math, Stats & CS, Dalhousie University, Halifax, NS, Canada
  10. Date: Tue, 10 Nov 1992 14:07:09 GMT
  11. Lines: 703
  12.  
  13. Here's the source to NAMEDP. I'm not sure if it made it to the group already.
  14. This is the 4th time I have posted it. I think I mucked up the last time.
  15.  Please do not mail me asking for help, unless
  16. a) i know you
  17. b) You can make me laugh.
  18.    Otherwise I have no time to help you install it.
  19. steve
  20.  
  21. # This is a shell archive.  Remove anything before this line,
  22. # then unpack it by saving it in a file and typing "sh file".
  23. #
  24. # Wrapped by Scratchy <napalm@molest> on Wed Jan 15 12:32:17 1992
  25. #
  26. # This archive contains:
  27. #    README        MANIFEST    Makefile    logfinger    
  28. #    plan.c        plan.nr        
  29. #
  30. # Existing files will not be overwritten.
  31. # Error checking via wc(1) will be performed.
  32. # Error checking via sum(1) will be performed.
  33.  
  34. LANG=""; export LANG
  35. PATH=/bin:/usr/bin:$PATH; export PATH
  36.  
  37. if sum -r </dev/null >/dev/null 2>&1
  38. then
  39.     sumopt='-r'
  40. else
  41.     sumopt=''
  42. fi
  43.  
  44. if test -f README
  45. then
  46.     echo Ok to overwrite existing file README\?
  47.     read answer
  48.     case "$answer" in
  49.     [yY]*)    echo Proceeding;;
  50.     *)    echo Aborting; exit 1;;
  51.     esac
  52.     rm -f README
  53.     if test -f README
  54.     then
  55.         echo Error: could not remove README, aborting
  56.         exit 1
  57.     fi
  58. fi
  59. echo x - README
  60. cat >README <<'@EOF'
  61. All I did was to put in a function that keeps track of the PID for
  62. plan by writing it to a file called ".planpid" in your home directory.
  63. Now you run plan in your .login, and, to kill the process when you log
  64. out, put something like this in your .logout:
  65.  
  66.     kill `cat /home/mine/.planpid`
  67.     rm -f /home/mine/.planpid
  68.  
  69. You have to remove the .planpid (or modify the code), because the 
  70. program will not run if a plan is already running, which it assumes
  71. when it finds a .planpid file already there.
  72.  
  73. If someone wanted to run multiple plans, maybe one for a .signature
  74. and another for a .plan, the save name for the PID could be changed,
  75. and the program compiled twice (the binary is not that big, ~40K on
  76. the HP 425's I used), or, if someone is really motivated, they could
  77. add a command line argument for the save name.
  78.  
  79. Sure, my modification isn't very complex, but it does what I needed
  80. it to do, and maybe someone else can use it.
  81.  
  82. Karen    (napalm@ugcs.caltech.edu)
  83.  
  84. ****  Additions by Geoff Loker ****
  85.  
  86. I have modified Tony Rems' code for plan a bit to get rid of the
  87. necessity for hard-coding in the file name to be set up as a FIFO.
  88. The program will now accept an optional argument that specifies the
  89. name of the FIFO to be used.  If that argument is not set, the default
  90. FIFO is $HOME/.plan.
  91.  
  92. In order to use this program, your O/S needs to support named pipes.
  93. You also need to link in getopt for the changes to work.
  94.  
  95. Any executable program can be set up to run when the specified FIFO is
  96. opened, but don't forget that the program you specify to run is being
  97. run under your userid.
  98.  
  99. ****  Original README ****
  100.  
  101. Date: Thu, 11 Apr 91 14:09:10 MST
  102. From: Jim Armstrong <armstron@cs.arizona.edu>
  103. Subject: RE: fingeree ...
  104.  
  105. > >About a month ago there was a sample program posted to this newsgroup that
  106. > >set up a FIFO named pipe as your .plan file.  I modified the code to set up
  107. > >a simple (perhaps naive) finger monitor for users on my machine.  The process
  108. > do you still have the source for it? would you send it to me?
  109.  
  110. Here is the article which appeared in comp.unix.questions a while back.  It
  111. contains generic code that will run any program you want whenever a certain
  112. file is accessed (i.e. the .plan file in this case).  All you have to do is
  113. compile it (it creates an executable called 'plan') and then to get it
  114. running say 'plan a.out &' where a.out is some program you have written.
  115. I don't have my program any more, but basically what I did was a ps au
  116. within that program.  It used egrep to search for someone currently fingering
  117. me and appended the output to a file.  To get really fancy you could then
  118. read from that file to find out exactly who it is (all in the same program)
  119. and print out a nice personal message to whoever is fingering you as part
  120. of what looks to be your .plan file.  A couple of things to watch out for:
  121. If the finger is remote, the ps au won't find anything.  Also, if two people
  122. finger you at the same time you may run into trouble, but I didn't try
  123. experimenting with this too much.  I also found it helpful to timestamp a
  124. date to the file, too (I used localtime() for efficiency).  This makes it
  125. easier to look back later at the file and see who's been fingering you and
  126. when while you were not logged on.  It also helpful in debugging your program.
  127.  
  128. So set up this code and experiment with different programs.  Just be creative
  129. and see what else you can do with it.  One idea I used for a while is making
  130. it print a different quote each time.  The possibilites are endless.  Enjoy.
  131.  
  132. Jim
  133.  
  134.  
  135. Article 31270 of comp.unix.questions:
  136. From: rembo@unisoft.UUCP (Tony Rems)
  137. Newsgroups: comp.unix.questions
  138. Subject: Re: Finger
  139. Date: 22 Feb 91 02:44:17 GMT
  140. Reply-To: rembo@unisoft.UUCP (Tony Rems)
  141. Organization: UniSoft Corporation -- UNIX R Us.
  142.  
  143. In article <37675@netnews.upenn.edu> minzhi@eniac.seas.upenn.edu (Min-Zhi Shao) writes:
  144. >
  145. >    When I fingered our system administrator, I got the following result:
  146. >
  147. >_________________________________________________________________________
  148. >Login name: gardella              In real life: Ed Gardella [CETS]
  149. >Directory: /home/cets/gardella          Shell: /usr/local/bin/bash
  150. >On since Feb 15 19:49:04 on ttyp1 from TSTEST.SEAS.UPEN
  151. >14 minutes Idle Time
  152. >No unread mail
  153. >Project: System Administrator eniac.seas.upenn.edu
  154. >Plan:
  155. >         Meander about until something interesting comes along.
  156. >
  157. >Office: 154 Moore Building           Work Phone: 898-2491
  158. >                                     Home Phone: 387-4104
  159. >
  160. >I have been fingered 3 times today
  161. >_________________________________________________________________________
  162. >
  163. >the .plan file in his home directory looks like:
  164. >
  165. >prw-r--r--  1 gardella        0 Feb 15 23:48 /home/cets/gardella/.plan
  166. >^
  167.  
  168. As you have found out by now, I'm sure, the p means that this is 
  169. a named pipe aka a FIFO.  If you'd like to do this yourself, here
  170. is a little program I wrote to do it (see the comments at the
  171. the beginning of the plan.c file for usage info):  
  172.  
  173. Here's the shar of my plan program, just cut up until it says
  174. "cut here", and then type 'sh filename' using whatever filename
  175. you save it as.  If you use 'plan' it will get overwritten.
  176.  
  177. The code here should compile w/o any problems on any BSD machine,
  178. I have tried it on a Sun, Vax 750, and Pyramid 90x.  It should
  179. also work properly on any SVR4.0 machine.  
  180.  
  181. The code is pretty heavily commented so it should be self
  182. explanatory.  
  183.  
  184. Note that you should put a -DFILENAME="your_home_dir/.plan"
  185. to get it to put your path in, or you can just edit the 
  186. source and change the value of FILENAME permanently.  
  187.  
  188. If you have any problems getting it compiled, just send me mail.
  189.  
  190. Enjoy.  
  191.  
  192. -Tony
  193.  
  194. @EOF
  195. set `sum $sumopt <README`; if test $1 -ne 65223
  196. then
  197.     echo ERROR: README checksum is $1 should be 65223
  198. fi
  199. set `wc -lwc <README`
  200. if test $1$2$3 != 1339725668
  201. then
  202.     echo ERROR: wc results of README are $* should be 133 972 5668
  203. fi
  204.  
  205. chmod 644 README
  206.  
  207. if test -f MANIFEST
  208. then
  209.     echo Ok to overwrite existing file MANIFEST\?
  210.     read answer
  211.     case "$answer" in
  212.     [yY]*)    echo Proceeding;;
  213.     *)    echo Aborting; exit 1;;
  214.     esac
  215.     rm -f MANIFEST
  216.     if test -f MANIFEST
  217.     then
  218.         echo Error: could not remove MANIFEST, aborting
  219.         exit 1
  220.     fi
  221. fi
  222. echo x - MANIFEST
  223. cat >MANIFEST <<'@EOF'
  224. MANIFEST - This file
  225. Makefile - The makefile
  226. README   - Original notes, notes for first set of changes, and notes
  227.        for my changes
  228. plan.c   - The program
  229. plan.nr  - A man page
  230. logfinger - a perl script included with the shar I got
  231. @EOF
  232. set `sum $sumopt <MANIFEST`; if test $1 -ne 19972
  233. then
  234.     echo ERROR: MANIFEST checksum is $1 should be 19972
  235. fi
  236. set `wc -lwc <MANIFEST`
  237. if test $1$2$3 != 743233
  238. then
  239.     echo ERROR: wc results of MANIFEST are $* should be 7 43 233
  240. fi
  241.  
  242. chmod 644 MANIFEST
  243.  
  244. if test -f Makefile
  245. then
  246.     echo Ok to overwrite existing file Makefile\?
  247.     read answer
  248.     case "$answer" in
  249.     [yY]*)    echo Proceeding;;
  250.     *)    echo Aborting; exit 1;;
  251.     esac
  252.     rm -f Makefile
  253.     if test -f Makefile
  254.     then
  255.         echo Error: could not remove Makefile, aborting
  256.         exit 1
  257.     fi
  258. fi
  259. echo x - Makefile
  260. cat >Makefile <<'@EOF'
  261. DEST          = /home/napalm/bin/fifo
  262.  
  263. EXTHDRS          = /usr/include/fcntl.h \
  264.         /usr/include/signal.h \
  265.         /usr/include/stdio.h \
  266.         /usr/include/sys/fcntl.h \
  267.         /usr/include/sys/file.h \
  268.         /usr/include/sys/stat.h \
  269.         /usr/include/sys/sysmacros.h \
  270.         /usr/include/sys/sysmacros.h \
  271.         /usr/include/sys/types.h \
  272.         /usr/include/sys/types.h
  273.  
  274. HDRS          =
  275.  
  276. LDFLAGS          =
  277.  
  278. LIBS          =
  279.  
  280. LINKER          = cc
  281.  
  282. MAKEFILE      = Makefile
  283.  
  284. OBJS          = plan.o
  285.  
  286. PRINT          = pr
  287.  
  288. PROGRAM          = plan
  289.  
  290. SRCS          = plan.c
  291.  
  292. all:        $(PROGRAM)
  293.  
  294. $(PROGRAM):     $(OBJS) $(LIBS)
  295.         @echo -n "Loading $(PROGRAM) ... "
  296.         @$(LINKER) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM)
  297.         @echo "done"
  298.  
  299. clean:;        @rm -f $(OBJS)
  300.  
  301. depend:;    @mkmf -f $(MAKEFILE) PROGRAM=$(PROGRAM) DEST=$(DEST)
  302.  
  303. index:;        @ctags -wx $(HDRS) $(SRCS)
  304.  
  305. install:    $(PROGRAM)
  306.         @echo Installing $(PROGRAM) in $(DEST)
  307.         @install -s $(PROGRAM) $(DEST)
  308.  
  309. print:;        @$(PRINT) $(HDRS) $(SRCS)
  310.  
  311. program:        $(PROGRAM)
  312.  
  313. tags:           $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS)
  314.  
  315. update:        $(DEST)/$(PROGRAM)
  316.  
  317. $(DEST)/$(PROGRAM): $(SRCS) $(LIBS) $(HDRS) $(EXTHDRS)
  318.         @make -f $(MAKEFILE) DEST=$(DEST) install
  319. ###
  320. plan.o: /usr/include/sys/types.h /usr/include/sys/sysmacros.h \
  321.     /usr/include/sys/sysmacros.h /usr/include/sys/file.h \
  322.     /usr/include/sys/fcntl.h /usr/include/sys/types.h \
  323.     /usr/include/fcntl.h /usr/include/stdio.h /usr/include/sys/stat.h \
  324.     /usr/include/signal.h
  325. @EOF
  326. set `sum $sumopt <Makefile`; if test $1 -ne 45642
  327. then
  328.     echo ERROR: Makefile checksum is $1 should be 45642
  329. fi
  330. set `wc -lwc <Makefile`
  331. if test $1$2$3 != 641331401
  332. then
  333.     echo ERROR: wc results of Makefile are $* should be 64 133 1401
  334. fi
  335.  
  336. chmod 644 Makefile
  337.  
  338. if test -f logfinger
  339. then
  340.     echo Ok to overwrite existing file logfinger\?
  341.     read answer
  342.     case "$answer" in
  343.     [yY]*)    echo Proceeding;;
  344.     *)    echo Aborting; exit 1;;
  345.     esac
  346.     rm -f logfinger
  347.     if test -f logfinger
  348.     then
  349.         echo Error: could not remove logfinger, aborting
  350.         exit 1
  351.     fi
  352. fi
  353. echo x - logfinger
  354. cat >logfinger <<'@EOF'
  355. #!/usr/bin/perl -- # -*-Perl-*-
  356.  
  357. $me = "geoff";
  358. $logfile = "/prod_10/geoff/.fingerees";
  359. $pscommand = "ps -auw";
  360.  
  361. open(PS, "$pscommand |");
  362. @fingers = grep(/(f\s+$me)|(finger\s+$me)/, <PS>);
  363. close(PS);
  364.  
  365. ($num) = unpack("A9", `wc -l $logfile`); # =~ s/^\s*(\d+).*\n/\1/;
  366. printf "I have been fingered %d time", $num;
  367. print "s" if ($num - 1);
  368. print " today\n";
  369. close(STDOUT);
  370.  
  371. open(LOG, ">>$logfile");
  372. foreach $line (@fingers) {
  373.     ($user) = $line =~ /^\s*(\S+)/;
  374.     print LOG "$user, at ", `date`;
  375. }
  376.  
  377. print(LOG "somebody, at ", `date`) if (! ($#fingers + 1));
  378. close(LOG);
  379. @EOF
  380. set `sum $sumopt <logfinger`; if test $1 -ne 41255
  381. then
  382.     echo ERROR: logfinger checksum is $1 should be 41255
  383. fi
  384. set `wc -lwc <logfinger`
  385. if test $1$2$3 != 2478571
  386. then
  387.     echo ERROR: wc results of logfinger are $* should be 24 78 571
  388. fi
  389.  
  390. chmod 755 logfinger
  391.  
  392. if test -f plan.c
  393. then
  394.     echo Ok to overwrite existing file plan.c\?
  395.     read answer
  396.     case "$answer" in
  397.     [yY]*)    echo Proceeding;;
  398.     *)    echo Aborting; exit 1;;
  399.     esac
  400.     rm -f plan.c
  401.     if test -f plan.c
  402.     then
  403.         echo Error: could not remove plan.c, aborting
  404.         exit 1
  405.     fi
  406. fi
  407. echo x - plan.c
  408. cat >plan.c <<'@EOF'
  409.  
  410. /*    THIS IS THE UNPUBLISHED SOURCE CODE OF REMBO        */
  411. /*    The copyright notice above does not evidence any       */
  412. /*    actual or intended publication of such source code.    */
  413. /*    So, use it if you like, but give me credit.        */
  414.  
  415.  
  416. /*     Usage: plan [-f file_name] program_name            */
  417.  
  418.  
  419. /*    Description:                    */
  420.  
  421. /*     This program takes the full pathname of an    */
  422. /*     executable and runs it on a fifo in the     */
  423. /*    user's home directory named .plan.  This    */
  424. /*     way, when finger is executed, the output    */
  425. /*     of the program goes to the fifo.        */
  426.     
  427. /*    Written by:  Tony Rems                 */
  428.  
  429. /*     Send bugs and flames to /dev/null or         */
  430. /*     rembo@unisoft.com                 */
  431.  
  432. /*    Modifications:                    */
  433.  
  434. /*    September 1991                    */
  435. /*           (by Geoff Loker geoff@mdms.moore.com)    */
  436. /*    Modified the program so that the path to the    */
  437. /*    .plan file is not hardcoded in.  Now any number    */
  438. /*    of users can use the program at the same time.    */
  439. /*    I also modified the program to use an optional    */
  440. /*    argument to specify which file to use.  The    */
  441. /*    default file used is still the user's .plan,    */
  442. /*    but this can now also be used to set up        */
  443. /*    .signatures or any other file the user wants.    */
  444.  
  445. /*    Even more modifications                */
  446.  
  447. /*    January 1992                    */
  448. /*          (by Karen Bruner napalm@ugcs.caltech.edu) */
  449. /*    Added pid_deal function, so people can stick    */
  450. /*     the program in their .login, and then have it    */
  451. /*    killed by their .logout.  Program will not    */
  452. /*    run if a .planpid file, the file with the PID    */
  453. /*    for plan, already exists in the user's home    */
  454. /*    directory.                    */
  455.  
  456. #include <sys/types.h>
  457. #include <sys/file.h>
  458. #include <stdio.h>
  459. #include <fcntl.h>
  460. #include <sys/stat.h>
  461. #include <signal.h>
  462. #include <string.h>
  463.  
  464. /* Defines */
  465. #define PERMS 0666
  466. #define USAGE "%s [-f file_name] program_name\n"
  467.  
  468. /* Function prototypes */
  469. void sig_handler();
  470. int pid_deal();    
  471.  
  472. main (argc, argv)
  473. int argc;
  474. char *argv[];
  475. {
  476.         int c, fflg;
  477.     char *file;
  478.         extern char *optarg;
  479.     extern int optind;
  480.     int fd;
  481.     int pid;
  482.     int status;
  483.     char *getenv(), *home, plan[256], *strcat(), *strcpy();
  484.     int pid_check;
  485.     
  486.     fflg = c = 0;
  487.     while ((c = getopt(argc, argv, "f:")) != EOF) {
  488.       file = optarg;
  489.       fflg++;
  490.     }
  491.  
  492. /* Comment out the next line if you don't want to have PID recorded
  493.    to file .planpid */
  494.  
  495.     pid_check = pid_deal(); /* check for .planpid, if none, write
  496.                    .planpid */
  497.  
  498. /* Uncomment next line if you commented out previous line */
  499.  
  500. /*  pid_check = 1; */
  501.  
  502.   if (pid_check == 1)  /* execute remaining part of program if .planpid
  503.               does not exist, i.e., no other plan process is
  504.               running */
  505.     {
  506.     if (fflg)
  507.       strcpy(plan, file);
  508.     else {
  509.       home = getenv("HOME");
  510.       strcpy(plan, home);
  511.       strcat(plan, "/.plan");
  512.     }
  513. /*    setenv("PLAN", plan, 1); */
  514.  
  515.     if ( argc != optind + 1 ) {
  516.         fprintf (stderr, USAGE, argv[0]);
  517.         exit(1);
  518.     }  /* if */
  519.  
  520. /* Catch interrupts for cleanup */
  521.     signal(SIGTERM, sig_handler);
  522.     signal(SIGINT, sig_handler);
  523.     signal(SIGHUP, sig_handler);
  524.  
  525.     unlink (plan);
  526.  
  527. /* Make the fifo */
  528.     if ((mknod(plan, S_IFIFO | PERMS, 0)) < 0 ) {
  529.         perror("mknod");
  530.         exit(2);
  531.     }  /* if */
  532.  
  533.     while (1) {
  534.         if ((fd = open(plan, O_WRONLY)) < 0 ) {
  535.             perror("open");
  536.             exit(3);
  537.         } /* if */
  538.  
  539. /* Once our open completes we know that someone else has
  540.  * opened the FIFO for reading, so we can know run our 
  541.  * program on it.  So, we fork, exec our program and
  542.  * wait for the child to complete.
  543.  */
  544.         switch (pid = fork()) {
  545.             case -1:
  546.                 perror("fork");
  547.                 exit(4);
  548.                 break;
  549.             case 0:
  550. /* If we're in the child, we copy our fifo to stdout */
  551. /* and exec the program given */
  552.                 dup2(fd, 1);
  553.                 execlp(argv[optind],argv[optind],(void *)NULL);
  554.                 perror("child returned");
  555.                 exit(5);
  556.                 break;
  557.             default:
  558. /* If we're in the parent, we close the pipe and wait */
  559.                 close(fd);
  560.                 while (wait(&status) != pid)
  561.                     ;
  562.                 break;
  563.         } /* switch */
  564.         sleep(2);
  565.         close(fd);
  566.     } /* while */
  567.     }  /* end of my if (pid_check... */
  568.  
  569.   else
  570.     printf("plan already running\n");
  571.  
  572. } /* main */
  573.  
  574. void sig_handler()  /* cleanup */
  575. {
  576.     char *plan, *getenv();
  577.     
  578.     plan = getenv("PLAN");
  579.  
  580.     unlink(plan);
  581.     exit(0);
  582. }
  583.  
  584. int pid_deal()    /* function for recording pid and making sure process
  585.            isn't already running */
  586. {
  587.   char savepid[100];    /* string for file name */
  588.   FILE *sp;
  589.   int checker;        /* return value:  0 if .planpid exists, and
  590.                program shouldn't be run, 1 if not */
  591.   char *home;
  592.  
  593.   home = getenv("HOME");        /* put save name for file */
  594.   strcpy(savepid, home);        /* in savepid */
  595.   strcat(savepid, "/.planpid");
  596.  
  597.   if ((sp = fopen(savepid, "r")) != NULL) /* test for existence of 
  598.                          .planpid by trying to open
  599.                          the file for reading */
  600.     checker = 0;     /* return a zero if read was successful, i.e.,
  601.                file already exists */
  602.     
  603.   else
  604.     checker = 1;    /* file doesn't exist, return a 1 to execute
  605.                the rest of the program */
  606.   fclose(sp);
  607.  
  608.   if (checker == 1)
  609.     {
  610.       sp = fopen(savepid, "w");
  611.       fprintf(sp, "%d", getpid());     /* puts PID for plan into file */
  612.       fclose(sp);
  613.     }
  614.  
  615.   return checker;
  616. @EOF
  617. set `sum $sumopt <plan.c`; if test $1 -ne 51212
  618. then
  619.     echo ERROR: plan.c checksum is $1 should be 51212
  620. fi
  621. set `wc -lwc <plan.c`
  622. if test $1$2$3 != 2088235034
  623. then
  624.     echo ERROR: wc results of plan.c are $* should be 208 823 5034
  625. fi
  626.  
  627. chmod 644 plan.c
  628.  
  629. if test -f plan.nr
  630. then
  631.     echo Ok to overwrite existing file plan.nr\?
  632.     read answer
  633.     case "$answer" in
  634.     [yY]*)    echo Proceeding;;
  635.     *)    echo Aborting; exit 1;;
  636.     esac
  637.     rm -f plan.nr
  638.     if test -f plan.nr
  639.     then
  640.         echo Error: could not remove plan.nr, aborting
  641.         exit 1
  642.     fi
  643. fi
  644. echo x - plan.nr
  645. cat >plan.nr <<'@EOF'
  646. .TH PLAN L "\*(V)" "4BSD"
  647. .SH NAME
  648. plan - run an executable when a specified FIFO is opened
  649. .SH SYNOPSIS
  650. .B plan
  651. [
  652. .BR -f file
  653. ]
  654. .B executable
  655. .SH DESCRIPTION
  656. .I plan
  657. takes the name of an executable program and runs it on a FIFO that
  658. is specified on the command line or on a FIFO in the user's home directory
  659. named .plan.  Whenever the FIFO is accessed, the output of the executable
  660. program goes to the FIFO.  It also writes the PID of plan to a file, so
  661. the process can be killed during logout, and it checks for the existence
  662. of this file to make sure plan isn't already running.
  663. .SH OPTIONS
  664. .TP
  665. .B \-f file_name
  666. The \fB\-f flag causes \fIplan\fR to set up the specified \fBfile_name\fR
  667. as a FIFO rather than the default \fB$HOME/.plan\fR.
  668. .PP
  669. Some sample uses of \fIplan\fR would be:
  670. .TP
  671. .B plan /usr/games/fortune &
  672. This will display a randomly selected fortune as the contents of
  673. your .plan file whenever you are fingered.
  674. .TP
  675. .B plan -f ~/.signature ~/bin/gensig &
  676. This will run the program gensig whenever your .signature file is accessed,
  677. allowing you to change your .signature whenever you post.
  678. .TP
  679. .B plan ~/bin/logfinger &
  680. This will run the program logfinger whenever your .plan file is accessed,
  681. and you can log all instances of people fingering you.
  682. .SH AUTHOR
  683. Tony Rems (rembo@unisoft.com)
  684. .PP
  685. Modifications by Geoff Loker (geoff@mdms.moore.com)
  686. More modifications by Karen Bruner (napalm@ugcs.caltech.edu)
  687. .SH BUGS
  688. Your system must support named pipes in order for this to work.
  689. @EOF
  690. set `sum $sumopt <plan.nr`; if test $1 -ne 57204
  691. then
  692.     echo ERROR: plan.nr checksum is $1 should be 57204
  693. fi
  694. set `wc -lwc <plan.nr`
  695. if test $1$2$3 != 432551495
  696. then
  697.     echo ERROR: wc results of plan.nr are $* should be 43 255 1495
  698. fi
  699.  
  700. chmod 644 plan.nr
  701.  
  702. exit 0
  703. --
  704.  
  705. Wed Jan 15 12:50:58 PST 1992
  706.  
  707. Thirty-two footsteps leading to the room where the paint doesn't wanna dry.
  708.  
  709.  
  710. -- 
  711. aasdSteveFranklin-Subliminal Psychology Major.ks;dlasBlueJaysRULEkasdfeahsdbfl
  712. sd;lfaswoq[eBuyMeAQuadra!!!mbnZMXCNdfsba;KdSPAMiuroqiyetIBMSuxiweuryth'ewr;mxn
  713. qpuepriuPartyOneqtuj;,n.,xnc,kjasFlameMeNot!;lkj;lkgkjd;askElvisLivesjhfquweru
  714. zx.cfranklin@ug.cs.dal.ca,sk;t;lrut[Superboy@ac.dal.cav.zx,Physics!eq3rwkh;oHA
  715.