Annotation of src/usr.bin/last/last.c, Revision 1.41
1.41 ! okan 1: /* $OpenBSD: last.c,v 1.40 2014/04/17 09:56:09 guenther Exp $ */
1.1 deraadt 2: /* $NetBSD: last.c,v 1.6 1994/12/24 16:49:02 cgd Exp $ */
3:
4: /*
5: * Copyright (c) 1987, 1993, 1994
6: * The Regents of the University of California. All rights reserved.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
1.26 millert 16: * 3. Neither the name of the University nor the names of its contributors
1.1 deraadt 17: * may be used to endorse or promote products derived from this software
18: * without specific prior written permission.
19: *
20: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30: * SUCH DAMAGE.
31: */
32:
33: #include <sys/param.h>
34: #include <sys/stat.h>
35:
1.35 chl 36: #include <ctype.h>
1.1 deraadt 37: #include <err.h>
38: #include <fcntl.h>
1.38 fgsch 39: #include <libgen.h>
1.1 deraadt 40: #include <paths.h>
41: #include <signal.h>
42: #include <stdio.h>
43: #include <stdlib.h>
44: #include <string.h>
45: #include <time.h>
46: #include <tzfile.h>
47: #include <unistd.h>
48: #include <utmp.h>
49:
50: #define NO 0 /* false/no */
51: #define YES 1 /* true/yes */
1.18 mickey 52: #define ATOI2(ar) ((ar)[0] - '0') * 10 + ((ar)[1] - '0'); (ar) += 2;
1.1 deraadt 53:
54: static struct utmp buf[1024]; /* utmp read buffer */
55:
1.33 deraadt 56: struct arg {
1.1 deraadt 57: char *name; /* argument */
58: #define HOST_TYPE -2
59: #define TTY_TYPE -3
60: #define USER_TYPE -4
61: int type; /* type of arg */
1.33 deraadt 62: struct arg *next; /* linked list pointer */
63: } *arglist;
1.1 deraadt 64:
1.33 deraadt 65: struct ttytab {
1.1 deraadt 66: time_t logout; /* log out time */
67: char tty[UT_LINESIZE + 1]; /* terminal name */
1.33 deraadt 68: struct ttytab*next; /* linked list pointer */
69: } *ttylist;
1.1 deraadt 70:
71: static time_t currentout; /* current logout value */
1.33 deraadt 72: static long maxrec = -1; /* records to display */
1.1 deraadt 73: static char *file = _PATH_WTMP; /* wtmp file */
1.6 mickey 74: static int fulltime = 0; /* Display seconds? */
1.33 deraadt 75: static time_t snaptime = 0; /* report only at this time */
76: static int calculate = 0;
77: static int seconds = 0;
1.1 deraadt 78:
1.19 millert 79: void addarg(int, char *);
1.33 deraadt 80: struct ttytab *addtty(char *);
1.19 millert 81: void hostconv(char *);
82: void onintr(int);
83: char *ttyconv(char *);
84: time_t dateconv(char *);
85: int want(struct utmp *, int);
86: void wtmp(void);
87: void checkargs(void);
1.40 guenther 88: void print_entry(const struct utmp *);
1.22 deraadt 89: void usage(void);
1.1 deraadt 90:
1.28 deraadt 91: #define NAME_WIDTH 9
1.14 fgsch 92: #define HOST_WIDTH 24
1.13 deraadt 93:
1.1 deraadt 94: int
1.27 deraadt 95: main(int argc, char *argv[])
1.1 deraadt 96: {
1.31 millert 97: const char *errstr;
1.33 deraadt 98: int ch, lastch = '\0', newarg = 1, prevoptind = 1;
1.1 deraadt 99:
1.32 millert 100: while ((ch = getopt(argc, argv, "0123456789cf:h:n:st:d:T")) != -1) {
1.1 deraadt 101: switch (ch) {
102: case '0': case '1': case '2': case '3': case '4':
103: case '5': case '6': case '7': case '8': case '9':
104: /*
105: * kludge: last was originally designed to take
106: * a number after a dash.
107: */
1.32 millert 108: if (newarg || !isdigit(lastch))
109: maxrec = 0;
110: else if (maxrec > INT_MAX / 10)
111: usage();
112: maxrec = (maxrec * 10) + (ch - '0');
1.1 deraadt 113: break;
1.9 downsj 114: case 'c':
115: calculate++;
116: break;
1.1 deraadt 117: case 'f':
118: file = optarg;
119: break;
120: case 'h':
121: hostconv(optarg);
122: addarg(HOST_TYPE, optarg);
123: break;
1.31 millert 124: case 'n':
125: maxrec = strtonum(optarg, 0, LONG_MAX, &errstr);
126: if (errstr != NULL)
127: errx(1, "number of lines is %s: %s", errstr,
128: optarg);
129: if (maxrec == 0)
130: exit(0);
131: break;
1.9 downsj 132: case 's':
133: seconds++;
134: break;
1.1 deraadt 135: case 't':
136: addarg(TTY_TYPE, ttyconv(optarg));
137: break;
1.4 jdm 138: case 'd':
139: snaptime = dateconv(optarg);
140: break;
1.6 mickey 141: case 'T':
1.9 downsj 142: fulltime = 1;
1.6 mickey 143: break;
1.1 deraadt 144: default:
1.22 deraadt 145: usage();
1.1 deraadt 146: }
1.32 millert 147: lastch = ch;
148: newarg = optind != prevoptind;
149: prevoptind = optind;
150: }
151: if (maxrec == 0)
152: exit(0);
1.1 deraadt 153:
154: if (argc) {
155: setlinebuf(stdout);
156: for (argv += optind; *argv; ++argv) {
157: #define COMPATIBILITY
158: #ifdef COMPATIBILITY
159: /* code to allow "last p5" to work */
160: addarg(TTY_TYPE, ttyconv(*argv));
161: #endif
162: addarg(USER_TYPE, *argv);
163: }
164: }
1.18 mickey 165:
1.5 jdm 166: checkargs();
1.1 deraadt 167: wtmp();
168: exit(0);
169: }
170:
171: /*
1.33 deraadt 172: * if snaptime is set, print warning if usernames, or -t or -h
173: * flags are also provided
1.5 jdm 174: */
175: void
1.27 deraadt 176: checkargs(void)
1.5 jdm 177: {
1.18 mickey 178: int ttyflag = 0;
1.33 deraadt 179: struct arg *step;
1.5 jdm 180:
1.33 deraadt 181: if (!snaptime || !arglist)
1.5 jdm 182: return;
183:
184: for (step = arglist; step; step = step->next)
185: switch (step->type) {
186: case HOST_TYPE:
1.7 deraadt 187: (void)fprintf(stderr,
188: "Warning: Ignoring hostname flag\n");
1.5 jdm 189: break;
190: case TTY_TYPE:
1.18 mickey 191: if (!ttyflag) { /* don't print this twice */
1.7 deraadt 192: (void)fprintf(stderr,
193: "Warning: Ignoring tty flag\n");
1.5 jdm 194: ttyflag = 1;
195: }
196: break;
197: case USER_TYPE:
1.7 deraadt 198: (void)fprintf(stderr,
199: "Warning: Ignoring username[s]\n");
1.5 jdm 200: break;
201: default:
1.20 millert 202: break;
1.5 jdm 203: /* PRINT NOTHING */
204: }
1.18 mickey 205: }
1.5 jdm 206:
1.40 guenther 207: void
208: print_entry(const struct utmp *bp)
209: {
210: printf("%-*.*s %-*.*s %-*.*s ",
211: NAME_WIDTH, UT_NAMESIZE, bp->ut_name,
212: UT_LINESIZE, UT_LINESIZE, bp->ut_line,
213: HOST_WIDTH, UT_HOSTSIZE, bp->ut_host);
214:
215: if (seconds)
216: printf("%lld", (long long)bp->ut_time);
217: else {
218: struct tm *tm;
219:
220: tm = localtime(&bp->ut_time);
221: if (tm == NULL) {
222: /* bogus entry? format as epoch time... */
223: printf("%lld", (long long)bp->ut_time);
224: } else {
225: char tim[40];
226:
227: strftime(tim, sizeof tim,
228: fulltime ? "%a %b %d %H:%M:%S" : "%a %b %d %H:%M",
229: tm);
230: printf("%s", tim);
231: }
232: }
233: }
234:
1.5 jdm 235:
236: /*
1.33 deraadt 237: * read through the wtmp file
1.1 deraadt 238: */
239: void
1.27 deraadt 240: wtmp(void)
1.1 deraadt 241: {
1.33 deraadt 242: time_t delta, total = 0;
243: int timesize, wfd, snapfound = 0;
1.40 guenther 244: char *ct, *crmsg;
1.33 deraadt 245: struct utmp *bp;
246: struct stat stb;
247: ssize_t bytes;
1.8 deraadt 248: off_t bl;
1.33 deraadt 249: struct ttytab *T;
250:
1.1 deraadt 251: if ((wfd = open(file, O_RDONLY, 0)) < 0 || fstat(wfd, &stb) == -1)
252: err(1, "%s", file);
253: bl = (stb.st_size + sizeof(buf) - 1) / sizeof(buf);
254:
1.6 mickey 255: if (fulltime)
256: timesize = 8; /* HH:MM:SS */
257: else
258: timesize = 5; /* HH:MM */
259:
1.1 deraadt 260: (void)time(&buf[0].ut_time);
261: (void)signal(SIGINT, onintr);
262: (void)signal(SIGQUIT, onintr);
263:
264: while (--bl >= 0) {
1.11 millert 265: if (lseek(wfd, bl * sizeof(buf), SEEK_SET) == -1 ||
1.1 deraadt 266: (bytes = read(wfd, buf, sizeof(buf))) == -1)
267: err(1, "%s", file);
268: for (bp = &buf[bytes / sizeof(buf[0]) - 1]; bp >= buf; --bp) {
269: /*
270: * if the terminal line is '~', the machine stopped.
271: * see utmp(5) for more info.
272: */
273: if (bp->ut_line[0] == '~' && !bp->ut_line[1]) {
274: /* everybody just logged out */
275: for (T = ttylist; T; T = T->next)
276: T->logout = -bp->ut_time;
277: currentout = -bp->ut_time;
278: crmsg = strncmp(bp->ut_name, "shutdown",
279: UT_NAMESIZE) ? "crash" : "shutdown";
1.33 deraadt 280:
1.18 mickey 281: /*
282: * if we're in snapshot mode, we want to
1.4 jdm 283: * exit if this shutdown/reboot appears
284: * while we we are tracking the active
285: * range
286: */
1.33 deraadt 287: if (snaptime && snapfound) {
288: close(wfd);
1.4 jdm 289: return;
1.33 deraadt 290: }
291:
1.18 mickey 292: /*
1.4 jdm 293: * don't print shutdown/reboot entries
1.18 mickey 294: * unless flagged for
295: */
1.5 jdm 296: if (want(bp, NO)) {
1.40 guenther 297: print_entry(bp);
298: printf("\n");
1.33 deraadt 299: if (maxrec != -1 && !--maxrec) {
300: close(wfd);
1.1 deraadt 301: return;
1.33 deraadt 302: }
1.1 deraadt 303: }
304: continue;
305: }
1.33 deraadt 306:
1.1 deraadt 307: /*
308: * if the line is '{' or '|', date got set; see
309: * utmp(5) for more info.
310: */
1.33 deraadt 311: if ((bp->ut_line[0] == '{' || bp->ut_line[0] == '|') &&
312: !bp->ut_line[1]) {
1.5 jdm 313: if (want(bp, NO)) {
1.40 guenther 314: print_entry(bp);
315: printf("\n");
1.33 deraadt 316: if (maxrec && !--maxrec) {
317: close(wfd);
1.1 deraadt 318: return;
1.33 deraadt 319: }
1.1 deraadt 320: }
321: continue;
322: }
1.33 deraadt 323:
1.1 deraadt 324: /* find associated tty */
325: for (T = ttylist;; T = T->next) {
326: if (!T) {
327: /* add new one */
328: T = addtty(bp->ut_line);
329: break;
330: }
331: if (!strncmp(T->tty, bp->ut_line, UT_LINESIZE))
332: break;
333: }
1.33 deraadt 334:
1.18 mickey 335: /*
1.4 jdm 336: * print record if not in snapshot mode and wanted
337: * or in snapshot mode and in snapshot range
338: */
339: if (bp->ut_name[0] &&
1.28 deraadt 340: ((want(bp, YES)) || (bp->ut_time < snaptime &&
341: (T->logout > snaptime || !T->logout ||
342: T->logout < 0)))) {
1.4 jdm 343: snapfound = 1;
1.40 guenther 344: print_entry(bp);
345: printf(" ");
1.33 deraadt 346:
1.1 deraadt 347: if (!T->logout)
348: puts(" still logged in");
349: else {
350: if (T->logout < 0) {
351: T->logout = -T->logout;
352: printf("- %s", crmsg);
1.9 downsj 353: } else {
1.18 mickey 354: if (seconds)
1.40 guenther 355: printf("- %lld",
356: (long long)T->logout);
1.9 downsj 357: else
358: printf("- %*.*s",
359: timesize, timesize,
360: ctime(&T->logout)+11);
1.1 deraadt 361: }
362: delta = T->logout - bp->ut_time;
1.9 downsj 363: if (seconds)
1.40 guenther 364: printf(" (%lld)\n",
365: (long long)delta);
1.9 downsj 366: else {
367: if (delta < SECSPERDAY)
368: printf(" (%*.*s)\n",
369: timesize, timesize,
370: asctime(gmtime(&delta))+11);
371: else
1.39 guenther 372: printf(" (%lld+%*.*s)\n",
373: (long long)delta / SECSPERDAY,
1.9 downsj 374: timesize, timesize,
375: asctime(gmtime(&delta))+11);
376: }
377: if (calculate)
378: total += delta;
1.1 deraadt 379: }
1.33 deraadt 380: if (maxrec != -1 && !--maxrec) {
381: close(wfd);
1.1 deraadt 382: return;
1.33 deraadt 383: }
1.1 deraadt 384: }
385: T->logout = bp->ut_time;
386: }
1.9 downsj 387: }
1.33 deraadt 388: close(wfd);
1.9 downsj 389: if (calculate) {
390: if ((total / SECSPERDAY) > 0) {
391: int days = (total / SECSPERDAY);
392: total -= (days * SECSPERDAY);
393:
394: printf("\nTotal time: %d days, %*.*s\n",
1.28 deraadt 395: days, timesize, timesize,
396: asctime(gmtime(&total))+11);
1.9 downsj 397: } else
398: printf("\nTotal time: %*.*s\n",
1.28 deraadt 399: timesize, timesize,
400: asctime(gmtime(&total))+11);
1.1 deraadt 401: }
402: ct = ctime(&buf[0].ut_time);
1.37 lum 403: printf("\n%s begins %10.10s %*.*s %4.4s\n", basename(file), ct,
404: timesize, timesize, ct + 11, ct + 20);
1.1 deraadt 405: }
406:
407: /*
1.33 deraadt 408: * see if want this entry
1.1 deraadt 409: */
410: int
1.27 deraadt 411: want(struct utmp *bp, int check)
1.1 deraadt 412: {
1.33 deraadt 413: struct arg *step;
1.1 deraadt 414:
1.15 deraadt 415: if (check) {
1.1 deraadt 416: /*
1.41 ! okan 417: * when ftp logs in over a network, the entry in
! 418: * the utmp file is the name plus its process id.
1.1 deraadt 419: */
420: if (!strncmp(bp->ut_line, "ftp", sizeof("ftp") - 1))
421: bp->ut_line[3] = '\0';
1.15 deraadt 422: }
1.5 jdm 423:
1.18 mickey 424: if (snaptime) /* if snaptime is set, return NO */
1.5 jdm 425: return (NO);
426:
1.1 deraadt 427: if (!arglist)
428: return (YES);
429:
430: for (step = arglist; step; step = step->next)
1.33 deraadt 431: switch (step->type) {
1.1 deraadt 432: case HOST_TYPE:
433: if (!strncasecmp(step->name, bp->ut_host, UT_HOSTSIZE))
434: return (YES);
435: break;
436: case TTY_TYPE:
437: if (!strncmp(step->name, bp->ut_line, UT_LINESIZE))
438: return (YES);
439: break;
440: case USER_TYPE:
441: if (!strncmp(step->name, bp->ut_name, UT_NAMESIZE))
442: return (YES);
443: break;
1.5 jdm 444: }
445:
1.1 deraadt 446: return (NO);
447: }
448:
449: /*
1.33 deraadt 450: * add an entry to a linked list of arguments
1.1 deraadt 451: */
452: void
1.27 deraadt 453: addarg(int type, char *arg)
1.1 deraadt 454: {
1.33 deraadt 455: struct arg *cur;
1.1 deraadt 456:
1.33 deraadt 457: if (!(cur = (struct arg *)malloc((u_int)sizeof(struct arg))))
1.1 deraadt 458: err(1, "malloc failure");
459: cur->next = arglist;
460: cur->type = type;
461: cur->name = arg;
462: arglist = cur;
463: }
464:
465: /*
1.33 deraadt 466: * add an entry to a linked list of ttys
1.1 deraadt 467: */
1.33 deraadt 468: struct ttytab *
1.27 deraadt 469: addtty(char *ttyname)
1.1 deraadt 470: {
1.33 deraadt 471: struct ttytab *cur;
1.1 deraadt 472:
1.33 deraadt 473: if (!(cur = (struct ttytab *)malloc((u_int)sizeof(struct ttytab))))
1.1 deraadt 474: err(1, "malloc failure");
475: cur->next = ttylist;
476: cur->logout = currentout;
477: memmove(cur->tty, ttyname, UT_LINESIZE);
478: return (ttylist = cur);
479: }
480:
481: /*
1.33 deraadt 482: * convert the hostname to search pattern; if the supplied host name
483: * has a domain attached that is the same as the current domain, rip
484: * off the domain suffix since that's what login(1) does.
1.1 deraadt 485: */
486: void
1.27 deraadt 487: hostconv(char *arg)
1.1 deraadt 488: {
1.33 deraadt 489: static char *hostdot, name[MAXHOSTNAMELEN];
1.1 deraadt 490: static int first = 1;
491: char *argdot;
492:
493: if (!(argdot = strchr(arg, '.')))
494: return;
495: if (first) {
496: first = 0;
497: if (gethostname(name, sizeof(name)))
498: err(1, "gethostname");
499: hostdot = strchr(name, '.');
500: }
501: if (hostdot && !strcasecmp(hostdot, argdot))
502: *argdot = '\0';
503: }
504:
505: /*
1.33 deraadt 506: * convert tty to correct name.
1.1 deraadt 507: */
508: char *
1.27 deraadt 509: ttyconv(char *arg)
1.1 deraadt 510: {
1.33 deraadt 511: size_t len = 8;
1.1 deraadt 512: char *mval;
513:
514: /*
515: * kludge -- we assume that all tty's end with
516: * a two character suffix.
517: */
518: if (strlen(arg) == 2) {
519: /* either 6 for "ttyxx" or 8 for "console" */
1.21 deraadt 520: if (!(mval = malloc(len)))
1.1 deraadt 521: err(1, "malloc failure");
522: if (!strcmp(arg, "co"))
1.21 deraadt 523: (void)strlcpy(mval, "console", len);
524: else
525: snprintf(mval, len, "tty%s", arg);
1.1 deraadt 526: return (mval);
527: }
528: if (!strncmp(arg, _PATH_DEV, sizeof(_PATH_DEV) - 1))
529: return (arg + 5);
530: return (arg);
531: }
1.4 jdm 532:
1.18 mickey 533: /*
534: * Convert the snapshot time in command line given in the format
1.23 deraadt 535: * [[[CC]YY]MMDD]hhmm[.SS]] to a time_t.
1.18 mickey 536: * Derived from atime_arg1() in usr.bin/touch/touch.c
1.4 jdm 537: */
538: time_t
1.27 deraadt 539: dateconv(char *arg)
1.4 jdm 540: {
1.7 deraadt 541: time_t timet;
542: struct tm *t;
543: int yearset;
544: char *p;
545:
546: /* Start with the current time. */
547: if (time(&timet) < 0)
548: err(1, "time");
549: if ((t = localtime(&timet)) == NULL)
550: err(1, "localtime");
551:
1.23 deraadt 552: /* [[[CC]YY]MMDD]hhmm[.SS] */
1.7 deraadt 553: if ((p = strchr(arg, '.')) == NULL)
1.18 mickey 554: t->tm_sec = 0; /* Seconds defaults to 0. */
1.7 deraadt 555: else {
556: if (strlen(p + 1) != 2)
557: goto terr;
558: *p++ = '\0';
559: t->tm_sec = ATOI2(p);
560: }
561:
562: yearset = 0;
563: switch (strlen(arg)) {
1.22 deraadt 564: case 12: /* CCYYMMDDhhmm */
1.7 deraadt 565: t->tm_year = ATOI2(arg);
566: t->tm_year *= 100;
567: yearset = 1;
1.29 otto 568: /* FALLTHROUGH */
1.22 deraadt 569: case 10: /* YYMMDDhhmm */
1.7 deraadt 570: if (yearset) {
571: yearset = ATOI2(arg);
572: t->tm_year += yearset;
573: } else {
574: yearset = ATOI2(arg);
575: if (yearset < 69)
576: t->tm_year = yearset + 2000;
577: else
578: t->tm_year = yearset + 1900;
579: }
1.28 deraadt 580: t->tm_year -= 1900; /* Convert to UNIX time. */
1.7 deraadt 581: /* FALLTHROUGH */
582: case 8: /* MMDDhhmm */
583: t->tm_mon = ATOI2(arg);
1.18 mickey 584: --t->tm_mon; /* Convert from 01-12 to 00-11 */
1.7 deraadt 585: t->tm_mday = ATOI2(arg);
586: t->tm_hour = ATOI2(arg);
587: t->tm_min = ATOI2(arg);
588: break;
589: case 4: /* hhmm */
590: t->tm_hour = ATOI2(arg);
591: t->tm_min = ATOI2(arg);
592: break;
593: default:
594: goto terr;
595: }
1.18 mickey 596: t->tm_isdst = -1; /* Figure out DST. */
1.7 deraadt 597: timet = mktime(t);
598: if (timet == -1)
1.28 deraadt 599: terr: errx(1, "out of range or illegal time specification: "
600: "[[[CC]YY]MMDD]hhmm[.SS]");
1.22 deraadt 601: return (timet);
1.4 jdm 602: }
603:
1.1 deraadt 604:
605: /*
1.33 deraadt 606: * on interrupt, we inform the user how far we've gotten
1.1 deraadt 607: */
608: void
1.27 deraadt 609: onintr(int signo)
1.1 deraadt 610: {
1.25 deraadt 611: char str[1024], *ct;
1.1 deraadt 612:
1.25 deraadt 613: ct = ctime(&buf[0].ut_time); /* XXX signal race */
614: snprintf(str, sizeof str, "\ninterrupted %10.10s %8.8s \n",
615: ct, ct + 11);
616: write(STDOUT_FILENO, str, strlen(str));
1.1 deraadt 617: if (signo == SIGINT)
1.25 deraadt 618: _exit(1);
1.22 deraadt 619: }
620:
621: void
622: usage(void)
623: {
624: extern char *__progname;
625:
626: fprintf(stderr,
1.34 jmc 627: "usage: %s [-csT] [-d date] [-f file] [-h host]"
628: " [-n number] [-t tty] [user ...]\n", __progname);
1.22 deraadt 629: exit(1);
1.1 deraadt 630: }