last: avoid leading "-" before "no logout"

This affects option --time-format=notime.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
This commit is contained in:
Ruediger Meier 2014-05-08 19:01:03 +02:00
parent 4fcbfaa81d
commit 6e69f1ee0f
2 changed files with 5 additions and 2 deletions

View File

@ -465,9 +465,12 @@ static int list(const struct last_control *ctl, struct utmp *p, time_t t, int wh
if (ctl->time_fmt > LAST_TIMEFTM_SHORT_CTIME) {
sprintf(logouttime, " gone - no logout");
length[0] = 0;
} else {
} else if (ctl->time_fmt == LAST_TIMEFTM_SHORT_CTIME) {
sprintf(logouttime, " gone");
sprintf(length, "- no logout");
} else {
logouttime[0] = 0;
sprintf(length, "no logout");
}
break;
case R_REBOOT:

View File

@ -90,7 +90,7 @@ accounti foo nine Wed Aug 28 03:00:00 2013 - Wed Aug 28 04:
wtmp begins Wed Aug 28 03:00:00 2013
~~~ no time ~~~
rick long never-gonna-logo (24855+03:14)
torvalds linux hobby - no logout
torvalds linux hobby no logout
reboot system boot system-name running
reboot system boot system-name (01:00)
IPv4 root dns-server (01:00)