Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Feb 2002 04:00:07 -0800 (PST)
From:      "Crist J. Clark" <cjc@FreeBSD.ORG>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/34834: "fix" of du(1) and -h
Message-ID:  <200202121200.g1CC07O71220@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/34834; it has been noted by GNATS.

From: "Crist J. Clark" <cjc@FreeBSD.ORG>
To: Tomas Svensson <tsn@gbdev.net>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/34834: "fix" of du(1) and -h
Date: Tue, 12 Feb 2002 03:50:37 -0800

 On Mon, Feb 11, 2002 at 10:36:46AM -0500, Tomas Svensson wrote:
 [snip]
 
 > >Description:
 > 	The manpages for df(1), du(1) and ls(1) claim that -h (print human-
 > 	readable numbers) will reduce the number of digits to three or fewer,
 > 	but this isn't true. It will print numbers such as 1000K or 1010K
 > 	(since these are slightly less than a megabyte). Also, the 'K' for
 > 	kilo should really be 'k'.
 
 'k' is generally used for multiples of 1000. 'K' is used for multiples
 of 1024. Sticking with 'K' is prefered except possibly for the '-H'
 option of df(1). But it seems like a lot of trouble to change that one
 case to 'k'.
 
 The current method does seem to be overkill. Why not just divide by
 1024 n-times until the result is < 1024 rather than ilogb(3)? We lose
 the math library, and we don't need that table of values.
 
 One comment about the patch,
 
 [snip]
 > +		printf("%qd.%qd%c", s1, s2, prefixes[i]);
 > +	} else
 > +		printf("%3qd%c", (bytes + 50) / 100, prefixes[i]);
 
 Quads? Ewwww...
 -- 
 Crist J. Clark                     |     cjclark@alum.mit.edu
                                    |     cjclark@jhu.edu
 http://people.freebsd.org/~cjc/    |     cjc@freebsd.org

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?200202121200.g1CC07O71220>