From: Ruediger Meier Date: Thu, 8 May 2014 15:45:31 +0000 (+0200) Subject: last: --time-format=full should do the same like -F X-Git-Tag: v2.25-rc1~195 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f16d5044e1f5c2dec5809b6e88b6bae083f8e142;p=thirdparty%2Futil-linux.git 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 --- diff --git a/login-utils/last.c b/login-utils/last.c index 7029963cc1..6935464031 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);