Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Jan 2010 18:09:33 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r202022 - user/ed/utmpx/usr.bin/last
Message-ID:  <201001101809.o0AI9Xjt001091@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001101809.o0AI9Xjt001091>