8082 last(1) should be able to print years in output

Review Request #470 - Created May 5, 2017 and updated

Information
Olaf Bohlen
illumos-gate
8082
Reviewers
general

8082 last(1) should be able to print years in output

For larger wtmpx files it is necessary to get also the year in the output for logins from the last(1) command.
This change implements it in the way that last will now support a -l parameter for long output.

A short explanation why I chose -l:

POSIX itself says nothing about the last command, so this was no reference.

FreeBSD has the -y switch to show years and -w to show also seconds, GNU/Linux has -F to print full login and logout times and dates.
I personally think that it is not necessary to print a full date/time string for login and logout, since the delta (time logged on) is also show (even prefixed with days).
So to shorten the length of the output line, I think it is enough to print the full date7time string on login (and additionally the seconds on logout).

olbohlen@oldn90700:.../illumos-gate/usr/src/cmd/last$ git pbchk
Man page format/spelling:
mandoc: ../../man/man1/last.1:19:2: WARNING: skipping paragraph macro: sp after SH
mandoc: ../../man/man1/last.1:59:2: WARNING: skipping paragraph macro: sp after SH
mandoc: ../../man/man1/last.1:102:2: WARNING: skipping paragraph macro: sp after SH
mandoc: ../../man/man1/last.1:107:2: WARNING: skipping paragraph macro: sp after SH
mandoc: ../../man/man1/last.1:117:2: WARNING: skipping paragraph macro: sp after SH

olbohlen@oldn90700:.../illumos-gate/usr/src/cmd/last$ /opt/gcc/4.4.4/bin/gcc -o newlast last.c
olbohlen@oldn90700:.../illumos-gate/usr/src/cmd/last$ ./newlast -h
usage: last [-n number] [-f filename] [-a ] [ -l ] [name | tty] ...
olbohlen@oldn90700:.../illumos-gate/usr/src/cmd/last$ ./newlast | head
olbohlen vt/2 :0 Fri May 5 09:45 still logged in
reboot system boot Fri May 5 09:42
reboot system down Fri May 5 09:17
olbohlen vt/2 :0 Fri May 5 07:22 - 09:16 (01:54)
reboot system boot Fri May 5 07:19
reboot system down Thu May 4 22:33
olbohlen vt/2 :0 Thu May 4 21:22 - 22:31 (01:09)
olbohlen vt/2 :0 Thu May 4 19:58 - 21:21 (01:23)
olbohlen vt/2 :0 Thu May 4 19:54 - 19:56 (00:02)
reboot system boot Thu May 4 19:52
olbohlen@oldn90700:.../illumos-gate/usr/src/cmd/last$ ./newlast -l | head
olbohlen vt/2 :0 Fri May 5 09:45:16 2017 still logged in
reboot system boot Fri May 5 09:42:58 2017
reboot system down Fri May 5 09:17:59 2017
olbohlen vt/2 :0 Fri May 5 07:22:37 2017 - 09:16:50 (01:54:13)
reboot system boot Fri May 5 07:19:08 2017
reboot system down Thu May 4 22:33:05 2017
olbohlen vt/2 :0 Thu May 4 21:22:25 2017 - 22:31:55 (01:09:30)
olbohlen vt/2 :0 Thu May 4 19:58:13 2017 - 21:21:35 (01:23:22)
olbohlen vt/2 :0 Thu May 4 19:54:37 2017 - 19:56:48 (00:02:11)
reboot system boot Thu May 4 19:52:55 2017
olbohlen@oldn90700:.../illumos-gate/usr/src/cmd/last$

Adam Števko
Toomas Soome
Olaf Bohlen
Olaf Bohlen
Review request changed

Description:

   

8082 last(1) should be able to print years in output

   
   

For larger wtmpx files it is necessary to get also the year in the output for logins from the last(1) command.

    This change implements it in the way that last will now support a -l parameter for long output.

  +
  +

A short explanation why I chose -l:

  +
  +

POSIX itself says nothing about the last command, so this was no reference.

  +
  +

FreeBSD has the -y switch to show years and -w to show also seconds, GNU/Linux has -F to print full login and logout times and dates.

  + I personally think that it is not necessary to print a full date/time string for login and logout, since the delta (time logged on) is also show (even prefixed with days).
  + So to shorten the length of the output line, I think it is enough to print the full date7time string on login (and additionally the seconds on logout).

Toomas Soome
Ship It!
Ken Mays
Ship It!
Loading...