=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/finger/finger.c,v retrieving revision 1.6 retrieving revision 1.7 diff -c -r1.6 -r1.7 *** src/usr.bin/finger/finger.c 1997/01/17 07:12:31 1.6 --- src/usr.bin/finger/finger.c 1997/05/30 23:35:51 1.7 *************** *** 1,4 **** ! /* $OpenBSD: finger.c,v 1.6 1997/01/17 07:12:31 millert Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. --- 1,4 ---- ! /* $OpenBSD: finger.c,v 1.7 1997/05/30 23:35:51 kstailey Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. *************** *** 37,43 **** */ /* ! * Mail status reporting added 931007 by Luke Mewburn, . */ #ifndef lint --- 37,49 ---- */ /* ! * Luke Mewburn added the following on 961121: ! * - mail status ("No Mail", "Mail read:...", or "New Mail ..., ! * Unread since ...".) ! * - 4 digit phone extensions (3210 is printed as x3210.) ! * - host/office toggling in short format with -h & -o. ! * - short day names (`Tue' printed instead of `Jun 21' if the ! * login time is < 6 days. */ #ifndef lint *************** *** 48,54 **** #ifndef lint /*static char sccsid[] = "from: @(#)finger.c 5.22 (Berkeley) 6/29/90";*/ ! static char rcsid[] = "$OpenBSD: finger.c,v 1.6 1997/01/17 07:12:31 millert Exp $"; #endif /* not lint */ /* --- 54,60 ---- #ifndef lint /*static char sccsid[] = "from: @(#)finger.c 5.22 (Berkeley) 6/29/90";*/ ! static char rcsid[] = "$OpenBSD: finger.c,v 1.7 1997/05/30 23:35:51 kstailey Exp $"; #endif /* not lint */ /* *************** *** 59,82 **** * * There are currently two output formats; the short format is one line * per user and displays login name, tty, login time, real name, idle time, ! * and office location/phone number. The long format gives the same ! * information (in a more legible format) as well as home directory, shell, ! * mail info, and .plan/.project files. */ #include #include #include #include #include "finger.h" time_t now; ! int lflag, sflag, mflag, pplan, Mflag; char tbuf[1024]; - int loginlist __P((void)); - void userlist __P((int, char **)); - int main(argc, argv) int argc; --- 65,89 ---- * * There are currently two output formats; the short format is one line * per user and displays login name, tty, login time, real name, idle time, ! * and either remote host information (default) or office location/phone ! * number, depending on if -h or -o is used respectively. ! * The long format gives the same information (in a more legible format) as ! * well as home directory, shell, mail info, and .plan/.project files. */ #include #include #include #include + #include + #include #include "finger.h" + #include "extern.h" time_t now; ! int entries, lflag, sflag, mflag, oflag, pplan, Mflag; char tbuf[1024]; int main(argc, argv) int argc; *************** *** 85,93 **** extern int optind; int ch; char domain[256]; - time_t time(); ! while ((ch = getopt(argc, argv, "lmMps")) != -1) switch(ch) { case 'l': lflag = 1; /* long format */ --- 92,101 ---- extern int optind; int ch; char domain[256]; ! oflag = 1; /* default to old "office" behavior */ ! ! while ((ch = getopt(argc, argv, "lmMpsho")) != -1) switch(ch) { case 'l': lflag = 1; /* long format */ *************** *** 104,113 **** case 's': sflag = 1; /* short format */ break; case '?': default: (void)fprintf(stderr, ! "usage: finger [-lmMps] [login ...]\n"); exit(1); } argc -= optind; --- 112,127 ---- case 's': sflag = 1; /* short format */ break; + case 'h': + oflag = 0; /* remote host info */ + break; + case 'o': + oflag = 1; /* office info */ + break; case '?': default: (void)fprintf(stderr, ! "usage: finger [-lmMpsho] [login ...]\n"); exit(1); } argc -= optind; *************** *** 149,158 **** exit(0); } ! int loginlist() { ! register PERSON *pn; struct passwd *pw; struct utmp user; char name[UT_NAMESIZE + 1]; --- 163,172 ---- exit(0); } ! void loginlist() { ! PERSON *pn; struct passwd *pw; struct utmp user; char name[UT_NAMESIZE + 1]; *************** *** 161,167 **** (void)fprintf(stderr, "finger: can't read %s.\n", _PATH_UTMP); exit(2); } ! name[UT_NAMESIZE] = NULL; while (fread((char *)&user, sizeof(user), 1, stdin) == 1) { if (!user.ut_name[0]) continue; --- 175,181 ---- (void)fprintf(stderr, "finger: can't read %s.\n", _PATH_UTMP); exit(2); } ! name[UT_NAMESIZE] = '\0'; while (fread((char *)&user, sizeof(user), 1, stdin) == 1) { if (!user.ut_name[0]) continue; *************** *** 179,188 **** void userlist(argc, argv) ! register argc; ! register char **argv; { ! register i; register PERSON *pn; PERSON *nethead, **nettail; struct utmp user; --- 193,202 ---- void userlist(argc, argv) ! int argc; ! char **argv; { ! register int i; register PERSON *pn; PERSON *nethead, **nettail; struct utmp user; *************** *** 221,227 **** enter_person(pw); used[i] = 1; } ! } else while (pw = getpwent()) for (i = 0; i < argc; i++) if (used[i] >= 0 && (!strcasecmp(pw->pw_name, argv[i]) || --- 235,241 ---- enter_person(pw); used[i] = 1; } ! } else while ((pw = getpwent()) != NULL) for (i = 0; i < argc; i++) if (used[i] >= 0 && (!strcasecmp(pw->pw_name, argv[i]) ||