[patch] last_fancy

Denys Vlasenko vda.linux at googlemail.com
Sun Nov 30 18:03:30 UTC 2008


On Thursday 27 November 2008 23:58, Cristian Ionescu-Idbohrn wrote:
> Just a simple cleanup patch.
> Please consider applying.

-       opt = getopt32(argv, "Wf:" /* "H" */, &filename);
-#ifdef BUT_UTIL_LINUX_LAST_HAS_NO_SUCH_OPT
+       opt = getopt32(argv, USE_FEATURE_LAST_FANCY_SHOW_HEADER("H") "Wf:",
+                      &filename);
+#ifdef ENABLE_FEATURE_LAST_FANCY_SHOW_HEADER

Support for -H seems to be commented out for a reason:
there is no such option in "standard" last.


-//     if (days) {
+       if (ENABLE_FEATURE_LAST_FANCY_TIME_DAYS || days) {
                sprintf(duration, "(%u+%02u:%02u)", days, hours, mins);
-//     } else {
-//             sprintf(duration, " (%02u:%02u)", hours, mins);
-//     }
+       } else {
+               sprintf(duration, " (%02u:%02u)", hours, mins);
+       }

I am not totally against sacrificing a few bytes here
and print (20:53) instead of (0+20:53). But you do need to try
to convince me why. :) Do you think people will have problems
with the concept of zero days?

Or are you saying "standard" last just prints 1234:53 for
logins spanning many days? If yes, we might just do that,
for compatibility. (I don't have "standard" last here to test).

Omitting days and just printing (hours mod 24) would be
bad enough to not do it even in the name of compat.
We already have such problem with years. Real output on my machine:

root     tty2                          Thu Jan  3 00:23 - 21:16 (0+20:53)
root     tty2                          Wed Jan  2 06:30 - 00:23 (0+17:52)
root     tty2                          Tue Jan  1 03:04 - 06:30 (1+03:25)
root     tty2                          Mon Dec 31 05:20 - 03:04 (0+21:44)
root     tty2                          Sun Dec 30 03:51 - 05:20 (1+01:29)
root     tty2                          Sat Dec 29 07:07 - 03:51 (0+20:43)

Ok, so it was a transition between years. WHICH YEARS?
Why this info is not shown?

This is a bigger problem than "do we want to print zero days".
--
vda



More information about the busybox mailing list