aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/last
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2012-11-04 02:52:03 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2012-11-04 02:52:03 +0000
commit23090366f729c56cab62de74c7a51792357e98a9 (patch)
treec511c885796e28ec571b5267e8f11f3b103d35e9 /usr.bin/last
parent7750ad47a9a7dbc83f87158464170c8640723293 (diff)
parent22ff74b2f44234d31540b1f7fd6c91489c37cad3 (diff)
downloadsrc-23090366f729c56cab62de74c7a51792357e98a9.tar.gz
src-23090366f729c56cab62de74c7a51792357e98a9.zip
Sync from head
Notes
Notes: svn path=/projects/bmake/; revision=242545
Diffstat (limited to 'usr.bin/last')
-rw-r--r--usr.bin/last/last.12
-rw-r--r--usr.bin/last/last.c20
2 files changed, 10 insertions, 12 deletions
diff --git a/usr.bin/last/last.1 b/usr.bin/last/last.1
index 4ac12bfe87c0..6cb2e6873a6b 100644
--- a/usr.bin/last/last.1
+++ b/usr.bin/last/last.1
@@ -28,7 +28,7 @@
.\" @(#)last.1 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$
.\"
-.Dd July 27, 2003
+.Dd January 21, 2010
.Dt LAST 1
.Os
.Sh NAME
diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c
index e587def5fcab..945cc4119ee0 100644
--- a/usr.bin/last/last.c
+++ b/usr.bin/last/last.c
@@ -72,12 +72,12 @@ typedef struct arg {
} ARG;
static ARG *arglist; /* head of linked list */
-static LIST_HEAD(idlisthead, idtab) idlist;
+static SLIST_HEAD(, idtab) idlist;
struct idtab {
time_t logout; /* log out time */
char id[sizeof ((struct utmpx *)0)->ut_id]; /* identifier */
- LIST_ENTRY(idtab) list;
+ SLIST_ENTRY(idtab) list;
};
static const char *crmsg; /* cause of last reboot */
@@ -206,7 +206,7 @@ wtmp(void)
char ct[80];
struct tm *tm;
- LIST_INIT(&idlist);
+ SLIST_INIT(&idlist);
(void)time(&t);
/* Load the last entries from the file. */
@@ -240,16 +240,14 @@ wtmp(void)
static void
doentry(struct utmpx *bp)
{
- struct idtab *tt, *ttx; /* idlist entry */
+ struct idtab *tt;
/* the machine stopped */
if (bp->ut_type == BOOT_TIME || bp->ut_type == SHUTDOWN_TIME) {
/* everybody just logged out */
- for (tt = LIST_FIRST(&idlist); tt;) {
- LIST_REMOVE(tt, list);
- ttx = tt;
- tt = LIST_NEXT(tt, list);
- free(ttx);
+ while ((tt = SLIST_FIRST(&idlist)) != NULL) {
+ SLIST_REMOVE_HEAD(&idlist, list);
+ free(tt);
}
currentout = -bp->ut_tv.tv_sec;
crmsg = bp->ut_type != SHUTDOWN_TIME ?
@@ -279,7 +277,7 @@ doentry(struct utmpx *bp)
return;
/* find associated identifier */
- LIST_FOREACH(tt, &idlist, list)
+ SLIST_FOREACH(tt, &idlist, list)
if (!memcmp(tt->id, bp->ut_id, sizeof bp->ut_id))
break;
@@ -290,7 +288,7 @@ doentry(struct utmpx *bp)
errx(1, "malloc failure");
tt->logout = currentout;
memcpy(tt->id, bp->ut_id, sizeof bp->ut_id);
- LIST_INSERT_HEAD(&idlist, tt, list);
+ SLIST_INSERT_HEAD(&idlist, tt, list);
}
/*