--- Makefile +++ Makefile 1994/04/08 09:32:32 @@ -0,0 +1,14 @@ +CFLAGS = -O2 -fomit-frame-pointer -m486 -include /usr/include/bsd/bsd.h \ + -I/usr/include/bsd +LDFLAGS = -s -v +LDLIBS = -lbsd + +finger: finger.o lprint.o net.o sprint.o util.o + +install: finger + install finger /usr/bin + install -m644 finger.1 /usr/man/man1 + +clean: + rm -f *.o finger + --- finger.c +++ finger.c 1994/04/08 09:32:32 @@ -65,6 +65,7 @@ #include #include #include +#include #include "finger.h" time_t now; @@ -145,10 +146,13 @@ (void)fprintf(stderr, "finger: can't read %s.\n", _PATH_UTMP); exit(2); } - name[UT_NAMESIZE] = NULL; + name[UT_NAMESIZE] = '\0'; while (fread((char *)&user, sizeof(user), 1, stdin) == 1) { if (!user.ut_name[0]) continue; +#ifdef USER_PROCESS + if (user.ut_type != USER_PROCESS) continue; +#endif if ((pn = find_person(user.ut_name)) == NULL) { bcopy(user.ut_name, name, UT_NAMESIZE); if ((pw = getpwnam(name)) == NULL) @@ -241,6 +245,9 @@ while (fread((char *)&user, sizeof(user), 1, stdin) == 1) { if (!user.ut_name[0]) continue; +#ifdef USER_PROCESS + if (user.ut_type != USER_PROCESS) continue; +#endif if ((pn = find_person(user.ut_name)) == NULL) continue; enter_where(&user, pn); --- finger.h +++ finger.h 1994/04/08 09:32:32 @@ -40,7 +40,7 @@ #include #include -#define _PATH_MAILSPOOL "/var/mail" +#define _PATH_MAILSPOOL "/var/spool/mail" /* * All unique persons are linked in a list headed by "head" and linkd --- lprint.c +++ lprint.c 1994/04/08 09:32:32 @@ -147,7 +147,8 @@ case LOGGEDIN: tp = localtime(&w->loginat); t = asctime(tp); - tzn = tp->tm_zone; + tzset(); + tzn = tzname[1 - daylight]; cpr = printf("On since %.16s (%s) on %s", t, tzn, w->tty); /* @@ -181,7 +182,8 @@ } tp = localtime(&w->loginat); t = asctime(tp); - tzn = tp->tm_zone; + tzset(); + tzn = tzname[1 - daylight]; if (now - w->loginat > SECSPERDAY * DAYSPERNYEAR / 2) cpr = printf("Last login %.16s %.4s (%s) on %s", @@ -203,16 +205,19 @@ else if (pn->mailrecv > pn->mailread) { tp = localtime(&pn->mailrecv); t = asctime(tp); - tzn = tp->tm_zone; + tzset(); + tzn = tzname[1 - daylight]; printf("New mail received %.16s %.4s (%s)\n", t, t + 20, tzn); tp = localtime(&pn->mailread); t = asctime(tp); - tzn = tp->tm_zone; + tzset(); + tzn = tzname[1 - daylight]; printf(" Unread since %.16s %.4s (%s)\n", t, t + 20, tzn); } else { tp = localtime(&pn->mailread); t = asctime(tp); - tzn = tp->tm_zone; + tzset(); + tzn = tzname[1 - daylight]; printf("Mail last read %.16s %.4s (%s)\n", t, t + 20, tzn); } } --- net.c +++ net.c 1994/04/08 09:32:32 @@ -62,7 +62,7 @@ if (!(host = rindex(name, '@'))) return; - *host++ = NULL; + *host++ = '\0'; if (!(hp = gethostbyname(host))) { defaddr.s_addr = inet_addr(host); if (defaddr.s_addr == -1) { --- sprint.c +++ sprint.c 1994/04/08 09:32:32 @@ -104,13 +104,18 @@ (void)printf(" %.4s", p + 20); else (void)printf(" %.5s", p + 11); -office: if (pn->office) +office: + if (w->host[0] != '\0') { + printf(" [ %s ]", w->host); + } else { + if (pn->office) (void)printf(" %-10.10s", pn->office); else if (pn->officephone) (void)printf(" %-10.10s", " "); if (pn->officephone) (void)printf(" %-.15s", prphone(pn->officephone)); + } putchar('\n'); } } @@ -149,7 +154,7 @@ if (!delta->tm_yday) if (!delta->tm_hour) if (!delta->tm_min) - (void)printf(" -"); + (void)printf(" "); else (void)printf("%5d", delta->tm_min); else --- util.c +++ util.c 1994/04/08 09:34:23 @@ -48,6 +48,7 @@ #include #include #include "finger.h" +#include find_idle_and_ttywrite(w) register WHERE *w; @@ -171,7 +172,7 @@ (long)pn->uid * sizeof(ll) || read(fd, (char *)&ll, sizeof(ll)) != sizeof(ll)) { /* as if never logged in */ - ll.ll_line[0] = ll.ll_host[0] = NULL; + ll.ll_line[0] = ll.ll_host[0] = '\0'; ll.ll_time = 0; } if ((w = pn->whead) == NULL)