From owner-freebsd-bugs Tue Feb 12 4: 3:45 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id B492437B41B for ; Tue, 12 Feb 2002 04:03:40 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g1CC07O71220; Tue, 12 Feb 2002 04:00:07 -0800 (PST) (envelope-from gnats) Date: Tue, 12 Feb 2002 04:00:07 -0800 (PST) Message-Id: <200202121200.g1CC07O71220@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: "Crist J. Clark" Subject: Re: bin/34834: "fix" of du(1) and -h Reply-To: "Crist J. Clark" 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 bin/34834; it has been noted by GNATS. From: "Crist J. Clark" To: Tomas Svensson 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