Date: Thu, 15 Aug 2002 11:10:04 -0700 (PDT) From: Bruce Evans <bde@zeta.org.au> To: freebsd-bugs@FreeBSD.org Subject: Re: misc/41674: iostat column formatting overlaps Message-ID: <200208151810.g7FIA4si080024@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/41674; it has been noted by GNATS.
From: Bruce Evans <bde@zeta.org.au>
To: Aragon Gouveia <aragon@phat.za.net>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: misc/41674: iostat column formatting overlaps
Date: Fri, 16 Aug 2002 04:08:54 +1000 (EST)
On Thu, 15 Aug 2002, Aragon Gouveia wrote:
> | By Bruce Evans <bde@zeta.org.au>
> | [ 2002-08-15 10:37 +0200 ]
> > This makes it a nightmare to read on 80-column terminals. The number of
> > devices shown by default would have to be reduced from 3 to only 2 to
> > reduce the line length to less than 80 columns again.
> >
> > Printing more precision might confuse parsers that expect plain integers,
> > especially if they know that the integers are formatted in 3 characters,
> > as they probably have to do to parse the run together digits.
>
> Ok understandable. I think the column spacing should atleast be increased a
> notch to accomodate "100" without overlapping with a value next to it.
>
> I didn't intend to include the precision change in my diff - that kinda
> slipped in by accident because I use it. I don't think it's necessary
> either, but would be a nice option to enable on the command line.
>
> Will %4.0f still be too big for 80 column terms?
It takes 80 exactly, which is 1 too many after line wrap. I suggest using
almost the same method as in vmstat: " %2.0f" always leaves a space and
usually has the same effect as "%3.0f". (vmstat uses "%2.0f " except for
the last field it uses "%2.0f".)
%%%
Index: iostat.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/iostat/iostat.c,v
retrieving revision 1.23
diff -u -2 -r1.23 iostat.c
--- iostat.c 26 Sep 2001 19:35:03 -0000 1.23
+++ iostat.c 15 Aug 2002 17:55:10 -0000
@@ -727,5 +728,5 @@
time += cur.cp_time[state];
for (state = 0; state < CPUSTATES; ++state)
- printf("%3.0f",
+ printf(" %2.0f",
rint(100. * cur.cp_time[state] / (time ? time : 1)));
}
%%%
Bruce
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208151810.g7FIA4si080024>
