summaryrefslogtreecommitdiffstats
path: root/login-utils/last.c
diff options
context:
space:
mode:
authorRuediger Meier2014-05-08 17:45:31 +0200
committerRuediger Meier2014-05-08 22:14:06 +0200
commitf16d5044e1f5c2dec5809b6e88b6bae083f8e142 (patch)
tree490caaecfff263970b232b8e8b7b89604769dae7 /login-utils/last.c
parentlast: fix uninitialized length (diff)
downloadkernel-qcow2-util-linux-f16d5044e1f5c2dec5809b6e88b6bae083f8e142.tar.gz
kernel-qcow2-util-linux-f16d5044e1f5c2dec5809b6e88b6bae083f8e142.tar.xz
kernel-qcow2-util-linux-f16d5044e1f5c2dec5809b6e88b6bae083f8e142.zip
last: --time-format=full should do the same like -F
For no reason "full" did something else than "iso" or -F as you see here: $ ./last -f ../tests/ts/last/wtmp.LE --time-format=full | grep -A2 "no logout" torvalds linux hobby Mon Aug 26 02:57:08 1991 gone - no logout reboot system boot system-name Wed Aug 28 20:00:00 2013 still running reboot system boot system-name Wed Aug 28 18:00:00 2013 - Wed Aug 28 19:00:00 2013 (01:00) $ ./last -f ../tests/ts/last/wtmp.LE --time-format=iso | grep -A2 "no logout" torvalds linux hobby 1991-08-26T02:57:08+0200 gone - no logout reboot system boot system-name 2013-08-28T20:00:00+0200 still running reboot system boot system-name 2013-08-28T18:00:00+0200 - 2013-08-28T19:00:00+0200 (01:00) $ ./last -f ../tests/ts/last/wtmp.LE -F | grep -A2 "no logout" torvalds linux hobby Mon Aug 26 02:57:08 1991 gone - no logout reboot system boot system-name Wed Aug 28 20:00:00 2013 still running reboot system boot system-name Wed Aug 28 18:00:00 2013 - Wed Aug 28 19:00:00 2013 (01:00) Also note the useless leading space before "gone" The only thing which matters is fmt->out width when printing these strings like "still running". Now ctl->fulltime flag is unsused and removed. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'login-utils/last.c')
-rw-r--r--login-utils/last.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/login-utils/last.c b/login-utils/last.c
index 7029963cc..693546403 100644
--- a/login-utils/last.c
+++ b/login-utils/last.c
@@ -82,8 +82,7 @@ struct last_control {
showhost :1, /* Show hostname */
altlist :1, /* Hostname at the end */
usedns :1, /* Use DNS to lookup the hostname */
- useip :1, /* Print IP address in number format */
- fulltime :1; /* Print full dates and times */
+ useip :1; /* Print IP address in number format */
unsigned int name_len; /* Number of login name characters to print */
unsigned int domain_len; /* Number of domain name characters to print */
@@ -434,7 +433,7 @@ static int list(const struct last_control *ctl, struct utmp *p, time_t t, int wh
epoch = time(NULL);
if (t == epoch) {
- if (ctl->fulltime) {
+ if (ctl->time_fmt > LAST_TIMEFTM_SHORT_CTIME) {
sprintf(logouttime, " still running");
length[0] = 0;
} else {
@@ -455,7 +454,7 @@ static int list(const struct last_control *ctl, struct utmp *p, time_t t, int wh
break;
case R_NOW:
length[0] = 0;
- if (ctl->fulltime)
+ if (ctl->time_fmt > LAST_TIMEFTM_SHORT_CTIME)
sprintf(logouttime, " still logged in");
else {
sprintf(logouttime, " still");
@@ -464,7 +463,7 @@ static int list(const struct last_control *ctl, struct utmp *p, time_t t, int wh
break;
case R_PHANTOM:
length[0] = 0;
- if (ctl->fulltime)
+ if (ctl->time_fmt > LAST_TIMEFTM_SHORT_CTIME)
sprintf(logouttime, " gone - no logout");
else {
sprintf(logouttime, " gone");
@@ -932,7 +931,6 @@ int main(int argc, char **argv)
ctl.altlist = 1;
break;
case 'F':
- ctl.fulltime = 1;
ctl.time_fmt = LAST_TIMEFTM_FULL_CTIME;
break;
case 'p':
@@ -962,8 +960,6 @@ int main(int argc, char **argv)
break;
case OPT_TIME_FORMAT:
ctl.time_fmt = which_time_format(optarg);
- if (ctl.time_fmt == LAST_TIMEFTM_ISO8601)
- ctl.fulltime = 1;
break;
default:
usage(stderr);