* src/numfmt.c (process line): Inspect the stdio error state when
outputting each line so that we don't have to check each output function
but do eventually exit upon write error, while also remaining buffered.
(main): Also check when outputting a header for the edge case
of very long headers.
* tests/misc/write-errors.sh: Enable the numfmt test case.
* NEWS: Mention the improvement, and reorganize all numfmt improvements.
'install' now uses posix_spawn() to invoke the strip program more efficiently.
- numfmt now parses numbers with a non-breaking space character before a unit,
- and parses numbers containing grouping characters from the current locale.
- It also supports a multi-byte --delimiter character.
+ 'numfmt':
+ - parses numbers with a non-breaking space character before a unit
+ - parses numbers containing grouping characters from the current locale
+ - supports a multi-byte --delimiter character
+ - no longer processes input indefinitely in the presence of write errors
wc -l now operates 10% faster on hosts that support AVX512 instructions.
if (newline)
putchar (line_delim);
+ if (ferror (stdout))
+ write_error ();
+
return valid_number;
}
while (header-- && getdelim (&line, &line_allocated,
line_delim, stdin) > 0)
- fputs (line, stdout);
+ {
+ if (fputs (line, stdout) == EOF)
+ write_error ();
+ }
while ((len = getdelim (&line, &line_allocated,
line_delim, stdin)) > 0)
head -z -n-1 /dev/zero
join -a 1 -z /dev/zero /dev/null
# TODO: nl --version; yes | nl
-# TODO: numfmt --version; yes 1 | numfmt
+numfmt --version; yes 1 | numfmt
od -v /dev/zero
paste /dev/zero
# TODO: pr /dev/zero