From owner-freebsd-bugs Thu Aug 15 11:20:25 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3DD5037B405 for ; Thu, 15 Aug 2002 11:20:07 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id D79D343E6A for ; Thu, 15 Aug 2002 11:20:06 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g7FIK5JU080989 for ; Thu, 15 Aug 2002 11:20:05 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g7FIK5Mq080988; Thu, 15 Aug 2002 11:20:05 -0700 (PDT) Date: Thu, 15 Aug 2002 11:20:05 -0700 (PDT) Message-Id: <200208151820.g7FIK5Mq080988@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Aragon Gouveia Subject: Re: misc/41674: iostat column formatting overlaps Reply-To: Aragon Gouveia Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR misc/41674; it has been noted by GNATS. From: Aragon Gouveia To: Bruce Evans Cc: freebsd-gnats-submit@FreeBSD.ORG Subject: Re: misc/41674: iostat column formatting overlaps Date: Thu, 15 Aug 2002 20:18:15 +0200 Perfect. :) | By Bruce Evans | [ 2002-08-15 20:02 +0200 ] > On Thu, 15 Aug 2002, Aragon Gouveia wrote: > > > | By Bruce Evans > > | [ 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