]> git.ipfire.org Git - thirdparty/coreutils.git/commit
numfmt: add --unit-separator
authorPádraig Brady <P@draigBrady.com>
Thu, 9 Oct 2025 13:24:12 +0000 (14:24 +0100)
committerPádraig Brady <P@draigBrady.com>
Fri, 17 Oct 2025 18:16:26 +0000 (19:16 +0100)
commit0f7babad383547c182bd85e97ff497edd11f6c20
tree69dae03e26678023d654faf0023e0f7c95c9a22e
parent006dfe4cd4dfc2c31ee4a21b6754dbbeb99ef407
numfmt: add --unit-separator

Output, accept, or disallow a string between the number and unit
as recommended in <https://physics.nist.gov/cuu/Units/checklist.html>
I.e. support outputting numbers of the form: "1234 M"

* src/numfmt.c (simple_strtod_human): Skip unit separator if present,
or disallow a unit separator if empty.
(double_to_human): Output unit separator if specified.
(main): Accept --unit-separator.
* tests/misc/numfmt.pl: Add test cases.
* doc/coreutils.texi: Describe the new option,
giving examples of interaction with --delimiter.
* NEWS: Mention the new feature.
* THANKS.in: Add Johannes Schauer Marin Rodrigues,
who provided a preliminary patch.
NEWS
THANKS.in
doc/coreutils.texi
src/numfmt.c
tests/misc/numfmt.pl