Hello Jasper,

On 12/14/17 13:22, Jasper Lievisse Adriaanse wrote:
> Hi,
> 
> currently w(1) on OpenBSD differs from other implementations
> (GNU/Darwin/FreeBSD/SmartOS) in that 'w -h' does print the
> 'USER TTY FROM ...' header whereas the others don't.
> 
> Is there a specific reason for it or could this diff below go in?

I don't know about the history to tell you, and I don't particularly
care about this change either way.

Do note that our uptime(1) says:
This is the “heading” information from w(1).

This has been removed from the FreeBSD uptime manpage.
So if we want to do the same thing, you should also adjust uptime.1.
> 
> Index: w.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/w/w.c,v
> retrieving revision 1.63
> diff -u -p -r1.63 w.c
> --- w.c       27 Jul 2017 14:17:34 -0000      1.63
> +++ w.c       14 Dec 2017 12:19:34 -0000
> @@ -224,7 +224,8 @@ main(int argc, char *argv[])
>  
>  #define HEADER       "USER    TTY FROM              LOGIN@  IDLE WHAT"
>  #define WUSED        (sizeof(HEADER) - sizeof("WHAT"))
> -     (void)puts(HEADER);
> +     if (header)
> +             (void)puts(HEADER);
>  
>       kp = kvm_getprocs(kd, KERN_PROC_ALL, 0, sizeof(*kp), &nentries);
>       if (kp == NULL)
> 

Reply via email to