svn commit: r202022 - user/ed/utmpx/usr.bin/last

Ed Schouten ed at FreeBSD.org
Sun Jan 10 18:09:34 UTC 2010


Author: ed
Date: Sun Jan 10 18:09:33 2010
New Revision: 202022
URL: http://svn.freebsd.org/changeset/base/202022

Log:
  Seems there was still something missing.
  
  We now need to print custom strings for entries that have nothing to do
  with logins/logouts.

Modified:
  user/ed/utmpx/usr.bin/last/last.c

Modified: user/ed/utmpx/usr.bin/last/last.c
==============================================================================
--- user/ed/utmpx/usr.bin/last/last.c	Sun Jan 10 18:00:45 2010	(r202021)
+++ user/ed/utmpx/usr.bin/last/last.c	Sun Jan 10 18:09:33 2010	(r202022)
@@ -333,9 +333,25 @@ printentry(struct utmpx *bp, struct idta
 	(void) strftime(ct, sizeof(ct), d_first ?
 	    (yflag ? "%a %e %b %Y %R" : "%a %e %b %R") :
 	    (yflag ? "%a %b %e %Y %R" : "%a %b %e %R"), tm);
-	printf("%-10s %-8s %-24.24s %s%c",
-	    bp->ut_user, bp->ut_line, bp->ut_host,
-	    ct, tt == NULL ? '\n' : ' ');
+	switch (bp->ut_type) {
+	case BOOT_TIME:
+		printf("%-44s", "boot time");
+		break;
+	case SHUTDOWN_TIME:
+		printf("%-44s", "shutdown time");
+		break;
+	case OLD_TIME:
+		printf("%-44s", "old time");
+		break;
+	case NEW_TIME:
+		printf("%-44s", "new time");
+		break;
+	case USER_PROCESS:
+		printf("%-10s %-8s %-24.24s",
+		    bp->ut_user, bp->ut_line, bp->ut_host);
+		break;
+	}
+	printf(" %s%c", ct, tt == NULL ? '\n' : ' ');
 	if (tt == NULL)
 		return;
 	if (!tt->logout) {


More information about the svn-src-user mailing list