home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume34 / ison / part01 < prev    next >
Encoding:
Text File  |  1992-12-06  |  21.3 KB  |  699 lines

  1. Newsgroups: comp.sources.misc
  2. From: mgleason@cse.unl.edu (Mike Gleason)
  3. Subject:  v34i004:  ison - Be informed when a specified user logs on, Part01/01
  4. Message-ID: <1992Dec6.031536.10635@sparky.imd.sterling.com>
  5. X-Md4-Signature: 22c5eb085567e7b8afbfdd4ec7c6d6e5
  6. Date: Sun, 6 Dec 1992 03:15:36 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: mgleason@cse.unl.edu (Mike Gleason)
  10. Posting-number: Volume 34, Issue 4
  11. Archive-name: ison/part01
  12. Environment: UNIX
  13. Supersedes: ison: Volume 32, Issue 104
  14.  
  15. Version 4.2 changes:
  16.    + Bug fixed where ison didn't die when you logged off.
  17.    + Manual page added.
  18.    + -j flag added for people who don't want IsOn to auto-background itself.
  19.    + Miscellaneous changes to the source.
  20.  
  21. IsOn's purpose is to let you know when someone logs on.  You could always sit
  22. there at your terminal typing 'finger' or 'who' every 5 minutes, but that's
  23. boring and unproductive.  IsOn makes this easy.  If you wanted to know the
  24. instant I logged on, all it would take is a simple:
  25.  
  26.    ison mgleason@cse.unl.edu
  27.  
  28. When I do log on, ison would respond:
  29.  
  30.    ** mgleason logged in since Wed Oct 16 02:19:33 1991
  31.  
  32. IsOn lowers it's priority automatically, so it takes very little CPU, and
  33. spares you the trouble of remembering to use 'nice.'  It also puts itself
  34. in the background automatically, as of version 4.  For remote addresses
  35. (those in dude@machine.domain format) the 'finger' utility is used, or for
  36. a user on the same machine that you are on, IsOn will simply walk the 'utmp'
  37. file.
  38.  
  39. Enjoy!
  40. --mike gleason = mgleason@cse.unl.edu
  41.  
  42. #! /bin/sh
  43. # This is a shell archive.  Remove anything before this line, then unpack
  44. # it by saving it into a file and typing "sh file".  To overwrite existing
  45. # files, type "sh file -c".  You can also feed this as standard input via
  46. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  47. # will see the following message at the end:
  48. #        "End of shell archive."
  49. # Contents:  ison.c ison.readme ison.1 Makefile
  50. # Wrapped by mgleason@cse on Fri Nov 20 18:10:01 1992
  51. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  52. if test -f 'ison.c' -a "${1}" != "-c" ; then 
  53.   echo shar: Will not clobber existing file \"'ison.c'\"
  54. else
  55. echo shar: Extracting \"'ison.c'\" \(13618 characters\)
  56. sed "s/^X//" >'ison.c' <<'END_OF_FILE'
  57. X/*  IsOn... Copyright 1990-92 NCEMRSoft.  Use at your own risk!
  58. X    To compile:
  59. X        BSD:      "cc -O -DBSD ison.c -o ison"
  60. X        System V: "cc -O ison.c -o ison"
  61. X    Version History:
  62. X    - v1.0 : 1990      : Phil Dietz, NCEMRSoft.
  63. X                       : Original release.
  64. X    - v2.0 : 05 Feb 91 : Phil Dietz, NCEMRSoft.
  65. X                       : Added 'finger'ing remote machines.
  66. X                       : Names and searches are now case insensitive.
  67. X    - v3.0 : 04 Aug 91 : Mike Gleason, NCEMRSoft.
  68. X                       : Complete rewrite, using unix system calls.
  69. X                       : Remote addresses are recognized automatically.
  70. X                       : IsOn nice's (lowers it's priority) itself.
  71. X                       : Remote commands are exec'd instead of subshelled.
  72. X                       : Uses handy getopt() function.
  73. X                       : Added -f option, in case you don't have finger,
  74. X                       :   our finger flags don't work, or want to try
  75. X                       :   it with rwho, etc.
  76. X                       : Added -d debugging option, so you can watch
  77. X                       :   ison's progress.  This is also useful if you
  78. X                       :   want to log to a file.
  79. X    - v4.0 : 31 Oct 91 : Mike Gleason, Mark Galassi, Tim Wilson.
  80. X                       : Added UTMP_FILE definition for SunOS.
  81. X                       : IsOn sends itself into the background!
  82. X                       : Added -a option, so you can specify a username
  83. X                       :   from a prompt, instead of on the command line,
  84. X                       :   to hide from ps, w, etc.
  85. X                       : IsOn should die if it's parent is killed (i.e.
  86. X                       :   you logout or hangup the serial line).
  87. X                       : Fixed big bug in stricmp().
  88. X                       : Should quit when finger gives an error; could
  89. X                       :   have done this earlier if finger would exit(1)
  90. X                       :   on an error like a nice program does.
  91. X                       : Changed default delay into two distincy delays,
  92. X                       :   one for remote (finger) and one for local.
  93. X                       :   The remote delay is much longer now, to be
  94. X                       :   more net friendly.
  95. X    - v4.1 : 15 Nov 91 : Didn't know there was a nice() system call :-);
  96. X                       :   replaced custom nice function with sys call.
  97. X    - v4.2 : 20 Nov 92 : Removed some unnecessary prototypes.  Added
  98. X                           CHECKSTDERR code so IsOn will die when you
  99. X                           logout.  Changed so you need to define BSD
  100. X                           to get index instead of having to define SYSV
  101. X                           to get strchr.  Removed shareware message.
  102. X                           Added -j option. 
  103. X    To do:
  104. X    -  Add an option to poll until the user is found AND not idle;
  105. X       Could be tricky due to different OS's finger output.
  106. X*/
  107. X
  108. X#define VERSION_STR "Version 4.2 (20 Nov 92)"
  109. X
  110. X#include <sys/types.h>
  111. X#include <sys/time.h>
  112. X#include <utmp.h>
  113. X#include <stdio.h>
  114. X#include <string.h>
  115. X#include <ctype.h>
  116. X#include <signal.h>
  117. X
  118. X#define SZ(expr) ((size_t) (expr))
  119. X#define DEFAULT_LOCAL_SLEEP 10   /* seconds to sleep between Utmp()'s */
  120. X#define DEFAULT_REMOTE_SLEEP 45  /* seconds to sleep between Finger()'s */
  121. X#define DDEBUG 0        /* prints stuff if > 0 */
  122. X#define DMAXITER -1L    /* loop forever until we find the guy */
  123. X#define DCOMMAND NULL   /* command line to do when user is found */
  124. X#define DFINGER "finger -fq"
  125. X#define NICE            /* when defined, I try to lower my priority. */
  126. X#define BEEP            /* when defined, I beep when the user is found. */
  127. X#define AUTOBG          /* when defined, I try to background myself. */
  128. X#define CHECKPARENT     /* check to see if our parent is alive */
  129. X#define CHECKSTDERR     /* check to see if stderr is a tty */
  130. X
  131. X#ifndef UTMP_FILE       /* Most define this in utmp.h;  SunOS 4.1.1 doesn't. */
  132. X#   define UTMP_FILE "/etc/utmp"
  133. X#endif
  134. X
  135. X#ifndef INDEX
  136. X#   ifdef BSD
  137. X#       define INDEX index
  138. X#   else
  139. X#       define INDEX strchr
  140. X#   endif
  141. X#endif
  142. X
  143. Xint strnicmp(), Nice(), Utmp(), Finger();
  144. X
  145. Xmain(argc, argv)
  146. X    int argc;
  147. X    char **argv;
  148. X{
  149. X    int                 sleep_sec = -1;
  150. X    int                 debug = DDEBUG;
  151. X    long                maxiter = DMAXITER;
  152. X    int                 notfound, flag;
  153. X    char                *username, hostname[64], *cp, prompted_name[64];
  154. X    int                 prompted = 0, parent_pid;
  155. X    int                 daemon = 1;
  156. X    char                *fingercmd = DFINGER;
  157. X    char                *cmd = DCOMMAND;
  158. X    time_t              logontime;
  159. X    extern int          getopt(), optind;   /* getopt() stuff */
  160. X    extern char         *optarg;            /* getopt() stuff */
  161. X
  162. X    if (argc <= 1)
  163. X        usage (argv[0]);
  164. X    parent_pid = getppid();
  165. X    while ((flag = getopt (argc, argv, "adjvs:p:i:f:")) != EOF)
  166. X        switch(flag) {
  167. X            case 'a':           /* ask for a name */
  168. X                printf("Name to check: ");
  169. X                gets(prompted_name);
  170. X                prompted = 1;
  171. X                break;
  172. X            case 'd':
  173. X            case 'v':   /* debug mode, verbose mode, same thing */
  174. X                debug++;
  175. X                break;
  176. X            case 'j':
  177. X                daemon = 0;
  178. X                break;
  179. X            case 's':
  180. X                cmd = optarg;
  181. X                break;
  182. X            case 'p':
  183. X                sleep_sec = atoi (optarg);
  184. X                break;
  185. X            case 'i':
  186. X                maxiter = (long) atol (optarg);
  187. X                break;
  188. X            case 'f':
  189. X                fingercmd = optarg;
  190. X                break;
  191. X            default: usage (argv[0]);
  192. X        }
  193. X    if (prompted == 0)
  194. X        username = argv[optind];
  195. X    else username = prompted_name;
  196. X
  197. X    if (username == NULL || strlen(username) == SZ(0))
  198. X        usage (argv[0]); /* no user specified! */
  199. X
  200. X#ifdef NICE
  201. X    /* lower our process' priority (nice) */
  202. X    (void) nice (20);
  203. X#endif
  204. X
  205. X#ifdef AUTOBG
  206. X    if (daemon) {
  207. X        if (fork())        /* automatically puts this task in background! */
  208. X            exit(3);
  209. X
  210. X        (void) signal(SIGINT, SIG_IGN);
  211. X        (void) signal(SIGQUIT, SIG_IGN);
  212. X    }
  213. X#endif
  214. X    (void) signal(SIGHUP, SIG_DFL);
  215. X
  216. X    if (debug > 0)
  217. X        printf("\nIsOn's PID: %d;  Parent: %d.\n", getpid(), parent_pid);
  218. X
  219. X    /*  Check the username for an @, which would suggest that it is
  220. X        a domain-style address. */
  221. X    if ((cp = INDEX (username, '@')) != NULL) {
  222. X        strcpy (hostname, cp);  /* @machine.domain.xxx */
  223. X        *cp = '\0';             /* shorten address down to just username */
  224. X        if (strlen(username) == SZ(0))
  225. X            usage (argv[0]);    /* no user specified! */
  226. X        if (sleep_sec < 0)
  227. X            sleep_sec = DEFAULT_REMOTE_SLEEP;
  228. X        notfound = Finger (username, sleep_sec, maxiter, argv[0],
  229. X            hostname, fingercmd, debug, parent_pid);
  230. X        time(&logontime);
  231. X    } else {
  232. X        if (sleep_sec < 0)
  233. X            sleep_sec = DEFAULT_LOCAL_SLEEP;
  234. X        notfound = Utmp (username, sleep_sec, maxiter, argv[0],
  235. X            debug, &logontime, parent_pid);
  236. X    }
  237. X
  238. X    /* See if the user was found.  If not, explain why not. */
  239. X    if (notfound != 0) {
  240. X        if (notfound > 0)   /* maxiter encoutered */
  241. X            (void) fprintf (stderr, "\n## %s is not on.\n", username);
  242. X        else (void) fprintf (stderr,
  243. X            "\n## %s: cannot go on because of errors.\n", argv[0]);
  244. X    } else {
  245. X        /* When we get here, the user we're looking for was detected. */
  246. X        (void) fprintf (stderr, "\n** %s%s logged in since %s",
  247. X#ifdef BEEP
  248. X            "\007",     /* Control-G, the ascii BEL character */
  249. X#else
  250. X            "",
  251. X#endif
  252. X            username, ctime(&logontime));
  253. X        if (cmd != NULL) {
  254. X            /* Run a command (script) if the user requested to. */
  255. X            (void) execlp ("/bin/sh", "sh", "-c", cmd, NULL);
  256. X            (void) perror (cmd);
  257. X        }
  258. X    }
  259. X    exit (notfound);
  260. X}   /* main */
  261. X
  262. X
  263. X
  264. X
  265. Xint Utmp(username, sleep_sec, maxiter, progname, debug, tyme, parent_pid)
  266. X    char                *username, *progname;
  267. X    int                 sleep_sec, debug, parent_pid;
  268. X    long                maxiter;
  269. X    time_t              *tyme;
  270. X{
  271. X    struct utmp         info;
  272. X    FILE                *in;
  273. X    register int        not_on = 1, iter = 1;
  274. X    char                theuser[16];
  275. X
  276. X    /* Open the utmp file, which is a list of all logged on users. */
  277. X    if ((in = fopen (UTMP_FILE, "r")) == NULL) {
  278. X        (void) perror (UTMP_FILE);
  279. X        return (-1);
  280. X    }
  281. X    
  282. X    do {
  283. X        if (debug > 0) {
  284. X            time(tyme);
  285. X            (void) printf("## %s: checking utmp (try #%d) at %s",
  286. X                progname, iter, ctime(tyme));
  287. X        }
  288. X
  289. X        /* Reset the utmp file and re-read it. */
  290. X        (void) rewind (in);
  291. X
  292. X#ifdef CHECKPARENT
  293. X        if (kill(parent_pid, 0))     /* we've lost our shell! */
  294. X            exit(2);
  295. X#endif
  296. X#ifdef CHECKSTDERR
  297. X        if (!isatty(2))
  298. X            exit(2);
  299. X#endif
  300. X
  301. X
  302. X        /* Cycle through all 'users' logged in. */
  303. X        while (not_on && (fread (&info, SZ(sizeof (info)), SZ(1), in)) == SZ(1)) {
  304. X            /* Inefficent, but necessary */
  305. X            strncpy(theuser, info.ut_name, SZ(8));
  306. X            theuser[8] = '\0';
  307. X            not_on = strnicmp(username, theuser, SZ(8));
  308. X            if (debug > 1 && theuser[0] != '\0')
  309. X                printf("%s\n", theuser);
  310. X        }
  311. X        
  312. X        /* Delay a little so we won't hog the CPU */
  313. X        if (not_on) {
  314. X            iter++;
  315. X            if ((maxiter > 0) && (iter > maxiter)) {
  316. X                not_on = 1;
  317. X                break;
  318. X            }
  319. X            if (iter == 2) {
  320. X                printf("\nPolling for %s...\n", username);
  321. X            }
  322. X            (void) sleep (sleep_sec);
  323. X        }
  324. X    } while (not_on);
  325. X    
  326. X    *tyme = info.ut_time;   /* will hold garbage if user not found! */
  327. X    (void) fclose (in);
  328. X    return (not_on);
  329. X}   /* Utmp */
  330. X
  331. X
  332. X
  333. X/* Maybe I should just break down and use a few global variables... */
  334. Xint Finger(username, sleep_sec, maxiter, progname, hostname, fingercmd, debug, parent_pid)
  335. X    char *username, *progname, *hostname, *fingercmd;
  336. X    int sleep_sec, debug, parent_pid;
  337. X    long maxiter;
  338. X{
  339. X    FILE                *in;
  340. X    register char       *cp;
  341. X    register int        not_on = 1, iter = 1, piperesult, pipelines;
  342. X    extern int          errno;
  343. X    char                buf[160], pipename[128];
  344. X    time_t              now;
  345. X    
  346. X    strcpy(pipename, fingercmd);
  347. X    strcat(pipename, " ");
  348. X    if (strnicmp("finger", fingercmd, SZ(6)) != 0)
  349. X        hostname++; /* Skip the @ sign if it's not finger! */
  350. X    strcat(pipename, hostname);
  351. X    
  352. X    do {
  353. X        if (debug > 0) {        
  354. X            time(&now);
  355. X            (void) printf("## %s: %s (try #%d), at %s",
  356. X                progname, pipename, iter, ctime(&now));
  357. X        }
  358. X
  359. X#ifdef CHECKPARENT
  360. X        if (kill(parent_pid, 0))     /* we've lost our shell! */
  361. X            exit(2);
  362. X#endif
  363. X#ifdef CHECKSTDERR
  364. X        if (!isatty(2))
  365. X            exit(2);
  366. X#endif
  367. X
  368. X        if ((in = popen (pipename, "r")) == NULL) {
  369. X            perror (fingercmd);
  370. X            not_on = errno;    /* a negative not_on signifies an error. */
  371. X            break;
  372. X        }
  373. X        
  374. X        /* Cycle through all 'users' logged in. */
  375. X        pipelines = 0;
  376. X        while (not_on && fgets (buf, (int)sizeof(buf), in) != NULL) {
  377. X            if (debug > 1) printf(buf);
  378. X            pipelines++;
  379. X            /* put a \0 in the first space after the username for strnicmp */
  380. X            cp = buf;
  381. X            while (*cp && isspace(*cp) == 0)
  382. X                cp++;
  383. X            *cp = '\0';
  384. X            not_on = strnicmp(username, buf, SZ(8));
  385. X        }
  386. X        
  387. X        piperesult = pclose(in);            /* close pipe */
  388. X        if (piperesult && not_on) {
  389. X            not_on = (piperesult > 0) ? -piperesult : piperesult;
  390. X            break;
  391. X        }
  392. X        if (pipelines <= 1) {
  393. X            /* finger probably puked */
  394. X            not_on = -1;
  395. X            break;
  396. X        }
  397. X
  398. X        /* Delay a little so we won't hog the CPU */
  399. X        if (not_on) {
  400. X            iter++;
  401. X            if ((maxiter > 0) && (iter > maxiter)) {
  402. X                not_on = 1;
  403. X                break;
  404. X            }
  405. X            if (iter == 2) {
  406. X                printf("\nPolling for %s...\n", username);
  407. X            }
  408. X            (void) sleep (sleep_sec);
  409. X        }
  410. X    } while (not_on);
  411. X    return (not_on);
  412. X}   /* Finger */
  413. X
  414. X
  415. X
  416. Xstrnicmp(a, b, n)
  417. X    register char *a, *b;
  418. X    register size_t n;
  419. X{
  420. X    register int A, B;
  421. X    
  422. X    while (n-- > (size_t)0) {
  423. X        A = tolower((int) *a++);
  424. X        B = tolower((int) *b++);
  425. X        if (A > B) return (A - B);
  426. X        if (B > A) return (B - A);
  427. X        if (A == 0 && B == 0) return (0);
  428. X    }
  429. X    return (0);    /* equal to n characters if we get here */
  430. X}   /* strnicmp */
  431. X
  432. X
  433. X
  434. X
  435. Xusage(progname)
  436. X    char *progname;
  437. X{   
  438. X    (void) fprintf (stderr,
  439. X"\nusage: %s [-p N] [-i N] [-s cmd] [-f cmd] [-d] %susername | -a %s\n\
  440. X\t-a     : Ask you for the user name, so others can't see it.\n\
  441. X\t-p N   : Seconds between iterations (defaults: local=%d, remote=%d).\n\
  442. X\t-i N   : Give up after 'N' iterations (default is infinity)\n\
  443. X\t-s cmd : Command to execute when user is found (i.e. \"talk username\")\n\
  444. X\t-f cmd : Command to execute for remote addresses (def: \"%s\")\n\
  445. X\t-d     : Debugging mode. More d's, more stuff.\n%s\
  446. X\n%s by Phil Dietz & Mike Gleason, NCEMRSoft.\n\n",
  447. X    progname,
  448. X#ifdef AUTOBG
  449. X    "[-j] ",
  450. X    "",
  451. X#else
  452. X    "",
  453. X    "&",
  454. X#endif
  455. X    DEFAULT_LOCAL_SLEEP,
  456. X    DEFAULT_REMOTE_SLEEP,
  457. X    DFINGER,
  458. X#ifdef AUTOBG
  459. X    "\t-j     : Don't go into the background automatically.\n",
  460. X#else
  461. X    "",
  462. X#endif
  463. X    VERSION_STR);
  464. X    exit (1);
  465. X}   /* usage */
  466. X
  467. X/* eof */
  468. END_OF_FILE
  469. if test 13618 -ne `wc -c <'ison.c'`; then
  470.     echo shar: \"'ison.c'\" unpacked with wrong size!
  471. fi
  472. # end of 'ison.c'
  473. fi
  474. if test -f 'ison.readme' -a "${1}" != "-c" ; then 
  475.   echo shar: Will not clobber existing file \"'ison.readme'\"
  476. else
  477. echo shar: Extracting \"'ison.readme'\" \(1215 characters\)
  478. sed "s/^X//" >'ison.readme' <<'END_OF_FILE'
  479. XSubject:  ison 4.2 - Be informed when a specified user logs on, Part01/01
  480. X
  481. XArchive-name: ison/part01
  482. XEnvironment: UNIX
  483. XSupersedes: ison: Volume 32, Issue 104
  484. X
  485. XVersion 4.2 changes:
  486. X   + Bug fixed where ison didn't die when you logged off.
  487. X   + Manual page added.
  488. X   + -j flag added for people who don't want IsOn to auto-background itself.
  489. X   + Miscellaneous changes to the source.
  490. X
  491. XIsOn's purpose is to let you know when someone logs on.  You could always sit
  492. Xthere at your terminal typing 'finger' or 'who' every 5 minutes, but that's
  493. Xboring and unproductive.  IsOn makes this easy.  If you wanted to know the
  494. Xinstant I logged on, all it would take is a simple:
  495. X
  496. X   ison mgleason@cse.unl.edu
  497. X
  498. XWhen I do log on, ison would respond:
  499. X
  500. X   ** mgleason logged in since Wed Oct 16 02:19:33 1991
  501. X
  502. XIsOn lowers it's priority automatically, so it takes very little CPU, and
  503. Xspares you the trouble of remembering to use 'nice.'  It also puts itself
  504. Xin the background automatically, as of version 4.  For remote addresses
  505. X(those in dude@machine.domain format) the 'finger' utility is used, or for
  506. Xa user on the same machine that you are on, IsOn will simply walk the 'utmp'
  507. Xfile.
  508. X
  509. XEnjoy!
  510. X--mike gleason = mgleason@cse.unl.edu
  511. X
  512. END_OF_FILE
  513. if test 1215 -ne `wc -c <'ison.readme'`; then
  514.     echo shar: \"'ison.readme'\" unpacked with wrong size!
  515. fi
  516. # end of 'ison.readme'
  517. fi
  518. if test -f 'ison.1' -a "${1}" != "-c" ; then 
  519.   echo shar: Will not clobber existing file \"'ison.1'\"
  520. else
  521. echo shar: Extracting \"'ison.1'\" \(1799 characters\)
  522. sed "s/^X//" >'ison.1' <<'END_OF_FILE'
  523. X.TH ISON 1 "20 November 1992"
  524. X.SH NAME
  525. Xison \- inform the user when someone logs on
  526. X.SH SYNOPSIS
  527. X.B ison
  528. X[
  529. X.B -d 
  530. X|
  531. X.B -v
  532. X]
  533. X[
  534. X.B -s
  535. X.I cmd
  536. X]
  537. X[
  538. X.B -p
  539. X.I seconds
  540. X]
  541. X[
  542. X.B -i
  543. X.I iterations
  544. X[
  545. X.B -f
  546. X.I finger-cmd
  547. X]
  548. X[
  549. X.B -j
  550. X]
  551. X.B -a
  552. X|
  553. X.I username
  554. X.SH DESCRIPTION
  555. X.I IsOn's 
  556. Xpurpose is it to let you know when someone logs on. 
  557. X.I IsOn
  558. Xlowers it's priority automatically, so it takes very little CPU, and
  559. Xspares you the trouble of remembering to use nice(1).  It also puts itself
  560. Xin the background automatically, as of version 4.  For remote addresses
  561. X(those in dude@machine.domain format) the finger(1) utility is used, or for
  562. Xa user on the same machine that you are on, 
  563. X.I IsOn 
  564. Xwill simply walk the utmp(5) file.
  565. X.PP
  566. X.I IsOn
  567. Xquits when its parent is killed (logout, hangup, etc) or the 
  568. X.I finger-cmd times out.
  569. X.SH OPTIONS
  570. X.IP -a
  571. XAsk you for the user name, so others can't see it within ps(1) output.
  572. X.IP -p
  573. XSpecify the 
  574. X.I seconds 
  575. Xbetween iterations (defaults: local=10, remote=45).
  576. X.IP -i
  577. XGive up after 
  578. X.I iterations 
  579. Xiterations (default is infinity).
  580. X.IP -d
  581. XTurn debugging mode on.
  582. X.IP -v
  583. XTurn debugging mode on.
  584. X.IP -j
  585. XDon't go in the background automatically.
  586. X.IP -s
  587. XExecute 
  588. X.I cmd
  589. Xwhen user is found.
  590. X.IP -f
  591. XExecute 
  592. X.I finger-cmd
  593. Xfor remote adresses (default: finger -fq).
  594. X.SH EXAMPLE
  595. XTo be informed when the author of
  596. X.I ison
  597. Xlogs on:
  598. X.IP
  599. X\fCison mgleason@cse.unl.edu\fP
  600. X.LP
  601. XShortly after the specifed user logs on,
  602. X.I ison
  603. Xwill print the message:
  604. X.IP
  605. X\fC** mgleason logged in since Wed Oct 16 02:19:33 1991\fP
  606. X
  607. X.SH FILES
  608. X.TP
  609. X.I /etc/utmp
  610. X.SH "SEE ALSO"
  611. Xfinger(1),
  612. Xps(1),
  613. Xw(1),
  614. Xwho(1)
  615. X.SH AUTHOR
  616. XVersion 4.0 by Mike Gleason (mgleason@cse.unl.edu),
  617. Xwith contributions from Mark Galassi and Tim Wilson.
  618. XCopyright 1990-92 NCEMRSoft.
  619. XManual page by Chris Lindig & R. P. C. Rodgers
  620. X.\" end of file
  621. END_OF_FILE
  622. if test 1799 -ne `wc -c <'ison.1'`; then
  623.     echo shar: \"'ison.1'\" unpacked with wrong size!
  624. fi
  625. # end of 'ison.1'
  626. fi
  627. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  628.   echo shar: Will not clobber existing file \"'Makefile'\"
  629. else
  630. echo shar: Extracting \"'Makefile'\" \(852 characters\)
  631. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  632. X# IsOn's Makefile
  633. X
  634. X# Source file name minus .c, and compiled exectuable's pathname.
  635. XCFILE=ison
  636. XOFILE=ison
  637. X
  638. X# Your favorite C Compiler, and flags.
  639. XCC=cc
  640. XCFLAGS=-O
  641. XLFLAGS=-s
  642. X
  643. X# Definitions can be:
  644. X# -DBSD:  If your system uses index instead of strchr.
  645. XDEFS=
  646. X
  647. XREADME=$(CFILE).readme
  648. XPACKAGE=$(CFILE).c $(README) $(CFILE).1 Makefile
  649. X
  650. Xall:
  651. X    $(CC) $(CFLAGS) $(DEFS) $(CFILE).c -o $(OFILE) $(LFLAGS)
  652. X    @ls -l $(CFILE)
  653. X
  654. Xshar:
  655. X    shar $(PACKAGE) | cat $(README) - > $(CFILE).shar
  656. X
  657. Xtar:
  658. X    tar cvf - $(PACKAGE) | compress -f > $(CFILE).tar.Z
  659. X
  660. Xclean:
  661. X    rm -f core $(OFILE)
  662. X
  663. Xclobber: clean
  664. X    rm -i $(PACKAGE)
  665. X
  666. X# I use these during development:
  667. Xlint:
  668. X    lint $(CFILE).c > $(CFILE).lint
  669. X
  670. Xdebug:
  671. X    $(CC) -g $(DEFS) $(CFILE).c -o $(OFILE)
  672. X    @ls -l $(OFILE)
  673. X
  674. Xmips:
  675. X    cc -O3 -s $(DEFS) $(CFILE).c -o $(OFILE)
  676. X    @rm -f $(CFILE).u
  677. X    @ls -l $(OFILE)
  678. X
  679. Xrz:
  680. X    rm -f $(CFILE).c
  681. X    rz -e
  682. X    make
  683. X
  684. END_OF_FILE
  685. if test 852 -ne `wc -c <'Makefile'`; then
  686.     echo shar: \"'Makefile'\" unpacked with wrong size!
  687. fi
  688. # end of 'Makefile'
  689. fi
  690. echo shar: End of shell archive.
  691. exit 0
  692. --
  693. ______________________________________________________________________________
  694. mike gleason                 mgleason@cse.unl.edu             NCEMRSoft, baby!
  695.  
  696. exit 0 # Just in case...
  697.