home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.misc
- From: franklin@ug.cs.dal.ca (Steve Franklin)
- Subject: v39i048: planner - Named pipe for random .plan or .signature, Part01/01
- Message-ID: <1993Aug23.042125.27928@sparky.sterling.com>
- X-Md4-Signature: f8be4a0379c069919c0f21ccbe41370f
- Sender: kent@sparky.sterling.com (Kent Landfield)
- Organization: Math, Stats & CS, Dalhousie University, Halifax, NS, Canada
- Date: Mon, 23 Aug 1993 04:21:25 GMT
- Approved: kent@sparky.sterling.com
-
- Submitted-by: franklin@ug.cs.dal.ca (Steve Franklin)
- Posting-number: Volume 39, Issue 48
- Archive-name: planner/part01
- Environment: Finger
-
- The following is the best implementation of a named pipe I have yet
- found. It can be used for generating a random .plan, .signature,
- etc. It has been modified and improved upon by a number of authors,
- and I have seen fit to repackage it with a simplistic means of
- installation, and a cool trick or two. I hope that people will use
- it wisely, because it can mess up machines (read docs) if you use it
- improperly.
-
- Direct questions to franklin@ug.cs.dal.ca
- Hope you find it interesting...
-
- Steve
- ---
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: README Makefile lf logfinger plan.1 plan.c plan.header
- # planner readme.orig renewplan
- # Wrapped by kent@sparky on Sun Aug 22 23:14:07 1993
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 1 (of 1)."'
- if test -f 'README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'README'\"
- else
- echo shar: Extracting \"'README'\" \(3158 characters\)
- sed "s/^X//" >'README' <<'END_OF_FILE'
- XSteve Franklin (not the original author)
- Xfranklin@ug.cs.dal.ca
- XCompiled on August 8th, 1993
- X
- XBefore I continue by describing what all of this does, I should point out that
- XI am not the original author of this software. I have modified it like
- Xmany before me and am now trying to simplify the documentation as so many
- Xusers have requested.
- X
- XPurpose: The purpose of namedp is to create an ultra cool .plan file so
- X that people can get random .plan's when they finger you. It
- X can be used in a variety of ways, and depending on how creative
- X you are, can make you rich beyond your wildest dreams (well, sorta)
- X
- XContents: Makefile Self-explanatory - type "make" to compile
- X logfinger Hardly changed this - perl script to log whos fingering
- X lf Short script to let you know when you were last fin'd
- X plan.1 Man page
- X plan.c C-code for the plan application
- X planner Shell script that shows a couple of neat tricks
- X readme.orig Original read me that was getting a tad "congested"
- X renewplan Script for starting up plan cleanly.
- X
- XChanges: The original plan seemed quite concerned with who was fingering you
- X from your local machine, but just logged "somebody" as fingering
- X you if it was from another machine. All it took was a few additions
- X (a la netstat) to let you figure out which machine is fingering you
- X and a few more changes to impress the fingerer by letting them
- X know their hostname. These settings are recorded into a file that
- X you can later query.
- X
- XRequirements: In order to run plan, you need bsd-ish architecture. Users
- X running ULTRIX are out of luck, as are VMS users of course.
- X
- XInstructions: The simplest way to sort through this is to first edit
- X "planner","renewplan" and "logfinger" to resemble your environ.
- X and your preferences. Then, place plan and renewplan in
- X your bin directory or any dir that your $PATH variable points
- X to. Simply type "renewplan" and it does the rest for you.
- X
- XQuestions: Feel free to send questions to franklin@ug.cs.dal.ca
- X but please try to read through all the documentation as well.
- X
- XCautions: If your machine reboots, you will have an empty named pipe
- X pointing at no process (it doesn't exist since the machine
- X rebooted). So, you have to restart the plan process (renewplan)
- X after a reboot. If you don't catch it, people's finger
- X processes will clog up your finger port. To get around this
- X I had an "at + 1 hour..." included in "renewplan" to re-exec
- X renewplan every hour - if there was a reboot, plan would
- X start up no more than an hour after the reboot.
- X
- XExample: Check out franklin@ug.cs.dal.ca for an example of how the
- X namedp pipe can be used - hopefully it's up and running :)
- X Hopefully you guys will mail me if you get neat ideas of
- X your own...
- END_OF_FILE
- if test 3158 -ne `wc -c <'README'`; then
- echo shar: \"'README'\" unpacked with wrong size!
- fi
- # end of 'README'
- fi
- if test -f 'Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Makefile'\"
- else
- echo shar: Extracting \"'Makefile'\" \(1401 characters\)
- sed "s/^X//" >'Makefile' <<'END_OF_FILE'
- XDEST = /home/napalm/bin/fifo
- X
- XEXTHDRS = /usr/include/fcntl.h \
- X /usr/include/signal.h \
- X /usr/include/stdio.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
- XLINKER = cc
- X
- XMAKEFILE = Makefile
- X
- XOBJS = plan.o
- X
- XPRINT = pr
- X
- XPROGRAM = plan
- X
- XSRCS = plan.c
- X
- Xall: $(PROGRAM)
- X
- X$(PROGRAM): $(OBJS) $(LIBS)
- X @echo -n "Loading $(PROGRAM) ... "
- X @$(LINKER) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM)
- X @echo "done"
- X
- Xclean:; @rm -f $(OBJS)
- X
- Xdepend:; @mkmf -f $(MAKEFILE) PROGRAM=$(PROGRAM) DEST=$(DEST)
- X
- Xindex:; @ctags -wx $(HDRS) $(SRCS)
- X
- Xinstall: $(PROGRAM)
- X @echo Installing $(PROGRAM) in $(DEST)
- X @install -s $(PROGRAM) $(DEST)
- X
- Xprint:; @$(PRINT) $(HDRS) $(SRCS)
- X
- Xprogram: $(PROGRAM)
- X
- Xtags: $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS)
- X
- Xupdate: $(DEST)/$(PROGRAM)
- 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/fcntl.h /usr/include/sys/types.h \
- X /usr/include/fcntl.h /usr/include/stdio.h /usr/include/sys/stat.h \
- X /usr/include/signal.h
- END_OF_FILE
- if test 1401 -ne `wc -c <'Makefile'`; then
- echo shar: \"'Makefile'\" unpacked with wrong size!
- fi
- # end of 'Makefile'
- fi
- if test -f 'lf' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lf'\"
- else
- echo shar: Extracting \"'lf'\" \(224 characters\)
- sed "s/^X//" >'lf' <<'END_OF_FILE'
- X#!/bin/sh
- Xtimeit=`ls -l /users/students/franklin/.dots/.fingerees | cut -c42-54`
- Xuser=`tail -2 /users/students/franklin/.dots/.fingerees | head -1 | cut -c1-8 | tr "," " "`
- Xecho "you were last fingered at:" $timeit by $user
- END_OF_FILE
- if test 224 -ne `wc -c <'lf'`; then
- echo shar: \"'lf'\" unpacked with wrong size!
- fi
- chmod +x 'lf'
- # end of 'lf'
- fi
- if test -f 'logfinger' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'logfinger'\"
- else
- echo shar: Extracting \"'logfinger'\" \(603 characters\)
- sed "s/^X//" >'logfinger' <<'END_OF_FILE'
- X#!/usr/bin/perl -- # -*-Perl-*-
- X
- X$me = "franklin";
- X$logfile = "/users/students/franklin/.fingerees";
- X$pscommand = "ps -auw";
- X
- Xopen(PS, "$pscommand |");
- X@fingers = grep(/(f\s+$me)|(finger\s+$me)/, <PS>);
- Xclose(PS);
- X
- X($num) = unpack("A9", `wc -l $logfile`); # =~ s/^\s*(\d+).*\n/\1/;
- X($num2) = $num/2;
- Xprintf "I have been fingered %d time", $num2;
- Xprint "s" if ($num - 1);
- Xprint " today\n";
- Xclose(STDOUT);
- X
- Xopen(LOG, ">>$logfile");
- Xforeach $line (@fingers) {
- X ($user) = $line =~ /^\s*(\S+)/;
- X print LOG "$user, at ", `date`;
- X}
- X
- Xprint(LOG "somebody, at ", `date`) if (! ($#fingers + 1));
- Xclose(LOG);
- END_OF_FILE
- if test 603 -ne `wc -c <'logfinger'`; then
- echo shar: \"'logfinger'\" unpacked with wrong size!
- fi
- chmod +x 'logfinger'
- # end of 'logfinger'
- fi
- if test -f 'plan.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'plan.1'\"
- else
- echo shar: Extracting \"'plan.1'\" \(1495 characters\)
- sed "s/^X//" >'plan.1' <<'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)
- XMore modifications by Karen Bruner (napalm@ugcs.caltech.edu)
- X.SH BUGS
- XYour system must support named pipes in order for this to work.
- END_OF_FILE
- if test 1495 -ne `wc -c <'plan.1'`; then
- echo shar: \"'plan.1'\" unpacked with wrong size!
- fi
- chmod +x 'plan.1'
- # end of 'plan.1'
- 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'\" \(5034 characters\)
- sed "s/^X//" >'plan.c' <<'END_OF_FILE'
- X
- 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#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
- 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
- X home = getenv("HOME"); /* put save name for file */
- X strcpy(savepid, home); /* in savepid */
- X strcat(savepid, "/.planpid");
- 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 5034 -ne `wc -c <'plan.c'`; then
- echo shar: \"'plan.c'\" unpacked with wrong size!
- fi
- # end of 'plan.c'
- fi
- if test -f 'plan.header' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'plan.header'\"
- else
- echo shar: Extracting \"'plan.header'\" \(731 characters\)
- sed "s/^X//" >'plan.header' <<'END_OF_FILE'
- XThe following is the best implementation of a named pipe I have yet
- Xfound. It can be used for generating a random .plan, .signature,
- Xetc. It has been modified and improved upon by a number of authors,
- Xand I have seen fit to repackage it with a simplistic means of
- Xinstallation, and a cool trick or two. I hope that people will use
- Xit wisely, because it can mess up machines (read docs) if you use it
- Ximproperly.
- X
- X Direct questions to franklin@ug.cs.dal.ca
- X Hope you find it interesting...
- X
- XSteve
- X
- Xp.s. of course, it's a uuencoded and zipped file. Perhaps as part of
- Xyour test to deem your worthiness, I have used the latest version of
- X"zip" to archive it. If you can't unzip this, you probably shouldn't
- Xbe installing it :)
- END_OF_FILE
- if test 731 -ne `wc -c <'plan.header'`; then
- echo shar: \"'plan.header'\" unpacked with wrong size!
- fi
- # end of 'plan.header'
- fi
- if test -f 'planner' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'planner'\"
- else
- echo shar: Extracting \"'planner'\" \(877 characters\)
- sed "s/^X//" >'planner' <<'END_OF_FILE'
- X#!/bin/sh
- Xperl $HOME/bin/namedp/logfinger
- X# This previous line points to the logfinger script
- X
- XWHO=`netstat -n | head -20 | grep ESTABLISHED | grep 129.173.4.4.79 | head -1 | awk '{ p=NF-1;printf "%s\n",$p}' | awk -F. '{printf "%s.%s.%s.%s\n",$1,$2,$3,$4}'`
- X# ^^^^^^^^^^^^^
- X# This is the finger port. Your IP number
- X# plus .79 (the finger port suffix)
- X# Change the IP number to reflect yours
- X
- Xif [ -z "$WHO" ]
- X then WHO='129.173.4.4'
- Xfi
- X
- X# If it doesn't catch any IP number fingering you then it must be a local
- X# finger
- X
- XHOST=`host $WHO 2>/dev/null| grep Name | awk '{ printf "%s\n",$2 }'`
- Xecho " " $WHO "->" $HOST >> $HOME/.fingerees
- Xecho "You're fingering me from "$WHO ", which is "$HOST
- XTIME=`date '+%H:%M, %D'`
- END_OF_FILE
- if test 877 -ne `wc -c <'planner'`; then
- echo shar: \"'planner'\" unpacked with wrong size!
- fi
- chmod +x 'planner'
- # end of 'planner'
- fi
- if test -f 'readme.orig' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'readme.orig'\"
- else
- echo shar: Extracting \"'readme.orig'\" \(5668 characters\)
- sed "s/^X//" >'readme.orig' <<'END_OF_FILE'
- 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 5668 -ne `wc -c <'readme.orig'`; then
- echo shar: \"'readme.orig'\" unpacked with wrong size!
- fi
- # end of 'readme.orig'
- fi
- if test -f 'renewplan' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'renewplan'\"
- else
- echo shar: Extracting \"'renewplan'\" \(357 characters\)
- sed "s/^X//" >'renewplan' <<'END_OF_FILE'
- X#!/bin/sh
- X if [ -f $HOME/.planpid ] ; then
- X kill -9 `cat $HOME/.planpid` >/dev/null 2>&1 ;
- X rm -f $HOME/.plan $HOME/.planpid >/dev/null 2>&1 ;
- X fi
- X if [ ! -f $HOME/.fingerees ] ; then
- X echo " " >$HOME/.fingerees ;
- X fi;
- X $HOME/bin/namedp/plan -f $HOME/.plan $HOME/bin/namedp/planner & sleep 2;
- X chmod a+r $HOME/.plan
- X
- END_OF_FILE
- if test 357 -ne `wc -c <'renewplan'`; then
- echo shar: \"'renewplan'\" unpacked with wrong size!
- fi
- chmod +x 'renewplan'
- # end of 'renewplan'
- fi
- echo shar: End of archive 1 \(of 1\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have the archive.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-