aboutsummaryrefslogtreecommitdiff
path: root/miscutils/last_fancy.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-06-01 10:10:22 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-06-01 10:10:22 +0000
commit62d85035895152c8232052dcfb1bbd3b549b7df9 (patch)
tree49c794fe1f2b108ddf394f6d0263d04b6a0973f5 /miscutils/last_fancy.c
parente0fd13e901253c5742f1e80778e149a0a07dc874 (diff)
downloadbusybox-62d85035895152c8232052dcfb1bbd3b549b7df9.tar.gz
- use ut_user rather than ut_name (Cristian Ionescu-Idbohrn)
- use ut_tv.tv_sec rather than ut_time (me) - shrink halt a little bit (me): halt_main 464 433 -31 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-31) Total: -31 bytes
Diffstat (limited to 'miscutils/last_fancy.c')
-rw-r--r--miscutils/last_fancy.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/miscutils/last_fancy.c b/miscutils/last_fancy.c
index d234a48bf..0dba9dca7 100644
--- a/miscutils/last_fancy.c
+++ b/miscutils/last_fancy.c
@@ -46,7 +46,7 @@ static void show_entry(struct utmp *ut, int state, time_t dur_secs)
const char *logout_str;
const char *duration_str;
- safe_strncpy(login_time, ctime(&(ut->ut_time)), 17);
+ safe_strncpy(login_time, ctime(&(ut->ut_tv.tv_sec)), 17);
snprintf(logout_time, 8, "- %s", ctime(&dur_secs) + 11);
dur_secs = MAX(dur_secs - (time_t)ut->ut_tv.tv_sec, (time_t)0);
@@ -87,7 +87,7 @@ static void show_entry(struct utmp *ut, int state, time_t dur_secs)
}
printf(HEADER_FORMAT,
- ut->ut_name,
+ ut->ut_user,
ut->ut_line,
show_wide ? INET6_ADDRSTRLEN : INET_ADDRSTRLEN,
show_wide ? INET6_ADDRSTRLEN : INET_ADDRSTRLEN,
@@ -112,19 +112,19 @@ static int get_ut_type(struct utmp *ut)
return ut->ut_type;
}
- if (ut->ut_name[0] == 0) {
+ if (ut->ut_user[0] == 0) {
return DEAD_PROCESS;
}
if ((ut->ut_type != DEAD_PROCESS)
- && (strcmp(ut->ut_name, "LOGIN") != 0)
- && ut->ut_name[0]
+ && (strcmp(ut->ut_user, "LOGIN") != 0)
+ && ut->ut_user[0]
&& ut->ut_line[0]
) {
ut->ut_type = USER_PROCESS;
}
- if (strcmp(ut->ut_name, "date") == 0) {
+ if (strcmp(ut->ut_user, "date") == 0) {
if (ut->ut_line[0] == '|') {
return OLD_TIME;
}
@@ -196,18 +196,18 @@ int last_main(int argc ATTRIBUTE_UNUSED, char **argv)
xlseek(file, pos, SEEK_SET);
xread(file, &ut, sizeof(ut));
/* rewritten by each record, eventially will have
- * first record's ut_time: */
- start_time = ut.ut_time;
+ * first record's ut_tv.tv_sec: */
+ start_time = ut.ut_tv.tv_sec;
switch (get_ut_type(&ut)) {
case SHUTDOWN_TIME:
- down_time = ut.ut_time;
+ down_time = ut.ut_tv.tv_sec;
boot_down = DOWN;
going_down = 1;
break;
case RUN_LVL:
if (is_runlevel_shutdown(&ut)) {
- down_time = ut.ut_time;
+ down_time = ut.ut_tv.tv_sec;
going_down = 1;
boot_down = DOWN;
}
@@ -240,7 +240,7 @@ int last_main(int argc ATTRIBUTE_UNUSED, char **argv)
next = el->link;
if (strncmp(up->ut_line, ut.ut_line, UT_LINESIZE) == 0) {
if (show) {
- show_entry(&ut, NORMAL, up->ut_time);
+ show_entry(&ut, NORMAL, up->ut_tv.tv_sec);
show = 0;
}
llist_unlink(&zlist, el);
@@ -271,7 +271,7 @@ int last_main(int argc ATTRIBUTE_UNUSED, char **argv)
}
if (going_down) {
- boot_time = ut.ut_time;
+ boot_time = ut.ut_tv.tv_sec;
llist_free(zlist, free);
zlist = NULL;
going_down = 0;