summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2014-04-30 15:05:15 +0100
committerPádraig Brady <P@draigBrady.com>2014-05-02 01:59:31 +0100
commit10a96524355775e6d8533555f185656c7f29075c (patch)
tree67c8aa976f39add33397afdeeaae67800d1bb55f /doc
parent59eacf2764a522f017c8289be94162b6f5163e8f (diff)
downloadcoreutils-10a96524355775e6d8533555f185656c7f29075c.tar.xz
numfmt: support zero padding using --format="%010f"
* src/numfmt.c (setup_padding_buffer): Simplify the code by not explicitly dealing with heap exhaustion. (parse_format_string): Likewise. Handle multiple grouping modifiers as does the standard printf. Handle the new leading zero --format modifier. (double_to_human): Use more defensive coding against overwriting stack buffers. Honor the leading zeros width. (usage): Mention the leading zero --format modifier. (main): Allow --padding in combo with a --format (width), as the number of leading zeros are useful independent of the main field width. * doc/coreutils.texi (numfmt invocation): Likewise. * tests/misc/numfmt.pl: Add new test cases. * NEWS: Mention the improvement.
Diffstat (limited to 'doc')
-rw-r--r--doc/coreutils.texi6
1 files changed, 4 insertions, 2 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 12002fcd4..a949ffcac 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -2293,10 +2293,12 @@ Convert the number in input field @var{n} (default: 1).
@item --format=@var{format}
@opindex --format
Use printf-style floating FORMAT string. The @var{format} string must contain
-one @samp{%f} directive, optionally with @samp{'}, @samp{-}, or width
+one @samp{%f} directive, optionally with @samp{'}, @samp{-}, @samp{0}, or width
modifiers. The @samp{'} modifier will enable @option{--grouping}, the @samp{-}
modifier will enable left-aligned @option{--padding} and the width modifier will
-enable right-aligned @option{--padding}.
+enable right-aligned @option{--padding}. The @samp{0} width modifier
+(without the @samp{-} modifier) will generate leading zeros on the number,
+up to the specified width.
@item --from=@var{unit}
@opindex --from