Subject: df / humanize
To: None <tech-userlevel@netbsd.org>
From: Tomas Svensson <tsn@gbdev.net>
List: tech-userlevel
Date: 03/14/2002 19:38:48
I added another argument to humanize_number to allow it to get or set
the scale/prefix index (multiplier = 1024 ^ scale). This allows
utilities like df(1) to use the same prefix for all numbers. Some
examples:

Old -h argument without the new function:

# df -h
Filesystem    Size   Used  Avail Capacity  Mounted on
/dev/wd0a     144M    35M   101M    25%    /
/dev/wd0e     4.8G   4.3G   317M    93%    /usr

New -u argument using the new function:

# df -u
Filesystem    Size   Used  Avail Capacity  Mounted on
/dev/wd0a     0.1G   0.0G   0.1G    25%    /
/dev/wd0e     4.8G   4.3G   0.3G    93%    /usr

New -u argument using four digits instead of three:

# df -u
Filesystem    Size   Used  Avail Capacity  Mounted on
/dev/wd0a     144M    35M   101M    25%    /
/dev/wd0e    4923M  4360M   317M    93%    /usr

Any opinions? Better or worse than the old function? Replace the old
function or have both (in df that is)?

Updated diff for humanize_number:
http://simba.unix1.net/netbsd/humanize5.diff

-Tomas