coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

numfmt (=print 'human' sizes) updates


From: Assaf Gordon
Subject: numfmt (=print 'human' sizes) updates
Date: Thu, 13 Dec 2012 01:02:47 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.7) Gecko/20120922 Icedove/10.0.7

Hello,

Attached is an updated version of 'numfmt' .
(The patch should be compatible with "git am").

Most of the previously raised issues have been addressed, except handling 
locale'd grouping in the input numbers (locale'd decimal-point is handled 
correctly).

Added support for header, auto-whitespace-padding, floating-point input .
Internally, all values are now stored as "long double" (instead of previously 
uintmax_t) - enables working with Yotta-scale values.

The following should now 'just work' :
    df | ./src/numfmt --header --field 2 --to=si
    ls -l | ./src/numfmt --header --field 5 --to=iec
    ls -lh | ./src/numfmt --header --field 5 --from=iec --padding=10

The "--debug" option now behaves more like sort's "--debug": prints messages to 
STDERR about possible bad combinations and inputs (which are not fatal errors):

    $./src/numfmt --debug 60000
    ./src/numfmt: no conversion option specified
    60000

The "--devdebug" option can be used to show internal states (perhaps will be 
removed once the program is finalized?).

The test file 'tests/misc/numfmt.pl' contains many more tests and details about 
possible inputs/outputs.

If the functionality is acceptable, the next steps are cleaner code and better 
documentations.

Comments are welcomed,
  -gordon

Attachment: numfmt.7.patch.gz
Description: GNU Zip compressed data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]