Re: w: don't print any header with -h
On 12/15/17 09:15, Sebastian Benoit wrote: > Martijn van Duren(openbsd+t...@list.imperialat.at) on 2017.12.14 14:03:24 > +0100: >> On 12/14/17 13:56, Jasper Lievisse Adriaanse wrote: >>> On Thu, Dec 14, 2017 at 01:35:18PM +0100, Martijn van Duren wrote: 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. >>> That still _is_ the heading information from w(1) when ran without flags so >>> I >>> don't think uptime.1 needs any changes. >> >> w(1) -h says: "suppress the heading" and uptime(1) says that the uptime >> is *the* heading. So with your patch we either remove more than the >> heading, or uptime becomes only part of the heading. >> >> Either way it creates an inconsistency. > > Nobody will be surprised by that. > > - This is "the heading" information from w(1). > + This is "the heading" information from w(1) except for the second line. > > I don't think that adds anything of value. Jasper already changed it to: Index: uptime.1 === RCS file: /cvs/src/usr.bin/w/uptime.1,v retrieving revision 1.14 retrieving revision 1.15 diff -u -u -r1.14 -r1.15 --- uptime.131 May 2007 19:20:19 - 1.14 +++ uptime.114 Dec 2017 18:03:03 - 1.15 @@ -1,4 +1,4 @@ -.\"$OpenBSD: uptime.1,v 1.14 2007/05/31 19:20:19 jmc Exp $ +.\"$OpenBSD: uptime.1,v 1.15 2017/12/14 18:03:03 jasper Exp $ .\" .\" Copyright (c) 1980, 1990, 1993, 1994 .\"The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)uptime.1 8.2 (Berkeley) 4/18/94 .\" -.Dd $Mdocdate: May 31 2007 $ +.Dd $Mdocdate: December 14 2017 $ .Dt UPTIME 1 .Os .Sh NAME @@ -44,9 +44,7 @@ the length of time the system has been up, the number of users, and the load average of the system over the last 1, 5, and 15 minutes. -This is the -.Dq heading -information from +This is the first line from .Xr w 1 . .Sh SEE ALSO .Xr w 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 - 1.63 > +++ w.c 14 Dec 2017 12:19:34 - > @@ -224,7 +224,8 @@ main(int argc, char *argv[]) > > #define HEADER "USERTTY 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), ); > if (kp == NULL) > >>> >>
Re: w: don't print any header with -h
Martijn van Duren(openbsd+t...@list.imperialat.at) on 2017.12.14 14:03:24 +0100: > On 12/14/17 13:56, Jasper Lievisse Adriaanse wrote: > > On Thu, Dec 14, 2017 at 01:35:18PM +0100, Martijn van Duren wrote: > >> 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. > > That still _is_ the heading information from w(1) when ran without flags so > > I > > don't think uptime.1 needs any changes. > > w(1) -h says: "suppress the heading" and uptime(1) says that the uptime > is *the* heading. So with your patch we either remove more than the > heading, or uptime becomes only part of the heading. > > Either way it creates an inconsistency. Nobody will be surprised by that. - This is "the heading" information from w(1). + This is "the heading" information from w(1) except for the second line. I don't think that adds anything of value. > >>> 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 - 1.63 > >>> +++ w.c 14 Dec 2017 12:19:34 - > >>> @@ -224,7 +224,8 @@ main(int argc, char *argv[]) > >>> > >>> #define HEADER "USERTTY 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), ); > >>> if (kp == NULL) > >>> > >> > > >
Re: w: don't print any header with -h
ok Jasper Lievisse Adriaanse(jas...@openbsd.org) on 2017.12.14 13:22:48 +0100: > 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? > > 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 - 1.63 > +++ w.c 14 Dec 2017 12:19:34 - > @@ -224,7 +224,8 @@ main(int argc, char *argv[]) > > #define HEADER "USERTTY 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), ); > if (kp == NULL) > > -- > jasper >
Re: w: don't print any header with -h
On 12/14/17 13:56, Jasper Lievisse Adriaanse wrote: > On Thu, Dec 14, 2017 at 01:35:18PM +0100, Martijn van Duren wrote: >> 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. > That still _is_ the heading information from w(1) when ran without flags so I > don't think uptime.1 needs any changes. w(1) -h says: "suppress the heading" and uptime(1) says that the uptime is *the* heading. So with your patch we either remove more than the heading, or uptime becomes only part of the heading. Either way it creates an inconsistency. > >>> 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 - 1.63 >>> +++ w.c 14 Dec 2017 12:19:34 - >>> @@ -224,7 +224,8 @@ main(int argc, char *argv[]) >>> >>> #define HEADER "USERTTY 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), ); >>> if (kp == NULL) >>> >> >
Re: w: don't print any header with -h
On Thu, Dec 14, 2017 at 01:35:18PM +0100, Martijn van Duren wrote: > 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. That still _is_ the heading information from w(1) when ran without flags so I don't think uptime.1 needs any changes. > > 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 - 1.63 > > +++ w.c 14 Dec 2017 12:19:34 - > > @@ -224,7 +224,8 @@ main(int argc, char *argv[]) > > > > #define HEADER "USERTTY 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), ); > > if (kp == NULL) > > > -- jasper
Re: w: don't print any header with -h
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 - 1.63 > +++ w.c 14 Dec 2017 12:19:34 - > @@ -224,7 +224,8 @@ main(int argc, char *argv[]) > > #define HEADER "USERTTY 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), ); > if (kp == NULL) >
w: don't print any header with -h
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? 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 - 1.63 +++ w.c 14 Dec 2017 12:19:34 - @@ -224,7 +224,8 @@ main(int argc, char *argv[]) #define HEADER "USERTTY 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), ); if (kp == NULL) -- jasper