Re: (Fwd) last(1) nit

2013-02-10 Thread Mark Lumsden
Printing just the file name (as opposed to the full path) is 
how NetBSD and linux behave. FreeBSD has the same behaviour as
OpenBSD. I'd follow the first 2. Any objections?

-lum

>Might I suggest using basename()?
>
>--- last.c.orig 2009-10-27 23:59:39.0 +
>+++ last.c  2013-02-09 01:43:04.709416732 +
>@@ -36,6 +36,7 @@
> #include 
> #include 
> #include 
>+#include 
> #include 
> #include 
> #include 
>@@ -407,7 +408,7 @@
>asctime(gmtime(&total))+11);
>}
>ct = ctime(&buf[0].ut_time);
>-   printf("\nwtmp begins %10.10s %*.*s %4.4s\n", ct, timesize, timesize,
>+   printf("\n%s begins %10.10s %*.*s %4.4s\n", basename(file),
>ct, timesize, timesize,
>ct + 11, ct + 20);
> }



Re: (Fwd) last(1) nit

2013-02-08 Thread Callum Davies
Might I suggest using basename()?

--- last.c.orig 2009-10-27 23:59:39.0 +
+++ last.c  2013-02-09 01:43:04.709416732 +
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -407,7 +408,7 @@
asctime(gmtime(&total))+11);
}
ct = ctime(&buf[0].ut_time);
-   printf("\nwtmp begins %10.10s %*.*s %4.4s\n", ct, timesize, timesize,
+   printf("\n%s begins %10.10s %*.*s %4.4s\n", basename(file),
ct, timesize, timesize,
ct + 11, ct + 20);
 }



(Fwd) last(1) nit

2013-02-08 Thread Jacob L. Leifman
ping?  ALL feedback is welcome :-)

--- Forwarded message follows ---
From:   "Jacob L. Leifman" 
To: tech@openbsd.org
Date sent:  Fri, 25 Jan 2013 18:34:55 -0500

The last(1) utility allows for an alternate data file to be specified 
with -f switch which is particularly useful for reviewing rotated 
versions of wtmp or forensic analysis.

What I found distracting (and made me briefly think it was not working) 
is that regardless this specification, at the end last(1) always prints 
"wtmp begins ..." because this name is hardcoded in the output.

Below is a quick-and-dirty patch to use the actual name of the data 
file. The "dirty" refers to the fact that it prints the full pathname 
(e.g. /var/log/wtmp) even in the most common use case when all defaults 
are used. Although this may be objectionable under the doctrine of 
least change, I also see a potential benefit that it will always 
indicate the source of the data in an unambiguous manner.

--- last.c.orig Thu Oct 29 00:33:55 2009
+++ last.c  Fri Jan 25 18:20:10 2013
@@ -407,7 +407,7 @@
asctime(gmtime(&total))+11);
}
ct = ctime(&buf[0].ut_time);
-   printf("\nwtmp begins %10.10s %*.*s %4.4s\n", ct, timesize, 
timesize,
+   printf("\n%s begins %10.10s %*.*s %4.4s\n", file, ct, timesize, 

timesize,
ct + 11, ct + 20);
 }


--- End of forwarded message ---


WPM$4FA7.PM$
Description: Mail message body