BSD 4_3_Reno release
[unix-history] / usr / src / usr.bin / finger / lprint.c
index 1808c17..3bb77d5 100644 (file)
@@ -2,11 +2,26 @@
  * Copyright (c) 1989 The Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1989 The Regents of the University of California.
  * All rights reserved.
  *
- * %sccs.include.redist.c%
+ * This code is derived from software contributed to Berkeley by
+ * Tony Nardo of the Johns Hopkins University/Applied Physics Lab.
+ *
+ * Redistribution and use in source and binary forms are permitted provided
+ * that: (1) source distributions retain this entire copyright notice and
+ * comment, and (2) distributions including binaries display the following
+ * acknowledgement:  ``This product includes software developed by the
+ * University of California, Berkeley and its contributors'' in the
+ * documentation or other materials provided with the distribution and in
+ * all advertising materials mentioning features or use of this software.
+ * Neither the name of the University nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)lprint.c   5.10 (Berkeley) %G%";
+static char sccsid[] = "@(#)lprint.c   5.12 (Berkeley) 6/24/90";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -16,8 +31,8 @@ static char sccsid[] = "@(#)lprint.c  5.10 (Berkeley) %G%";
 #include <tzfile.h>
 #include <stdio.h>
 #include <ctype.h>
 #include <tzfile.h>
 #include <stdio.h>
 #include <ctype.h>
+#include <paths.h>
 #include "finger.h"
 #include "finger.h"
-#include "pathnames.h"
 
 #define        LINE_LEN        80
 #define        TAB_LEN         8               /* 8 spaces between tabs */
 
 #define        LINE_LEN        80
 #define        TAB_LEN         8               /* 8 spaces between tabs */
@@ -49,9 +64,10 @@ lprint(pn)
        register struct tm *delta;
        register WHERE *w;
        register int cpr, len, maxlen;
        register struct tm *delta;
        register WHERE *w;
        register int cpr, len, maxlen;
+       struct tm *tp;
        int oddfield;
        time_t time();
        int oddfield;
        time_t time();
-       char *t, *ctime(), *prphone();
+       char *t, *tzn, *prphone();
 
        /*
         * long format --
 
        /*
         * long format --
@@ -114,8 +130,11 @@ lprint(pn)
        for (w = pn->whead; w != NULL; w = w->next) {
                switch (w->info) {
                case LOGGEDIN:
        for (w = pn->whead; w != NULL; w = w->next) {
                switch (w->info) {
                case LOGGEDIN:
-                       cpr = printf("On since %16.16s on %s",
-                           ctime(&w->loginat), w->tty);
+                       tp = localtime(&w->loginat);
+                       t = asctime(tp);
+                       tzn = tp->tm_zone;
+                       cpr = printf("On since %16.16s (%s) on %s",
+                           t, tzn, w->tty);
                        /*
                         * idle time is tough; if have one, print a comma,
                         * then spaces to pad out the device name, then the
                        /*
                         * idle time is tough; if have one, print a comma,
                         * then spaces to pad out the device name, then the
@@ -145,13 +164,15 @@ lprint(pn)
                                (void)printf("Never logged in.");
                                break;
                        }
                                (void)printf("Never logged in.");
                                break;
                        }
-                       t = ctime(&w->loginat);
+                       tp = localtime(&w->loginat);
+                       t = asctime(tp);
+                       tzn = tp->tm_zone;
                        if (now - w->loginat > SECSPERDAY * DAYSPERNYEAR / 2)
                        if (now - w->loginat > SECSPERDAY * DAYSPERNYEAR / 2)
-                               cpr = printf("Last login %10.10s, %4.4s on %s",
-                                   t, t + 20, w->tty);
+                               cpr = printf("Last login %10.10s (%s), %4.4s on %s",
+                                   t, t + 20, tzn, w->tty);
                        else
                        else
-                               cpr = printf("Last login %16.16s on %s",
-                                       t, w->tty);
+                               cpr = printf("Last login %16.16s (%s) on %s",
+                                   t, tzn, w->tty);
                        break;
                }
                if (*w->host) {
                        break;
                }
                if (*w->host) {