summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2010-11-10 20:34:52 -0800
committerJim Meyering <meyering@redhat.com>2010-11-11 08:16:24 +0100
commit6568b173db1c98f39a53eadd9b09e0a0e5c11920 (patch)
treeccbc21bc55d866e91db9e97453505d9c66263360 /doc
parent0339eb4598600024cedca14a7e882c1737dd2d82 (diff)
downloadcoreutils-6568b173db1c98f39a53eadd9b09e0a0e5c11920.tar.xz
csplit: do not rely on undefined behavior in printf formats
* doc/coreutils.texi (csplit invocation): Say that %d and %i are aliases for %u. * src/csplit.c (FLAG_THOUSANDS, FLAG_ALTERNATIVE): New constants. (get_format_flags): Now take char const * and int * and return size_t. It now stores info about the flags instead of merely scanning them. Also, it handles '0' correctly. Drop support for the undocumented '+' and ' ' flags since the value is unsigned. Add support for the (undocumented) "'" flag. All uses changed. (get_format_width, get_format_prec): Remove. (check_format_conv_type): Renamed from get_format_conv_type, with a different signature. It now converts the format to one that is compatible with unsigned int, and checks flags. All uses changed. (max_out): Have snprintf compute the number of bytes needed rather than attempting to do it ourselves (which doesn't work portably with outlandish formats such as %4294967296d). (check_format_conv_type, main): Check for overflow in size calculations. Don't assume size_t fits in unsigned int. * tests/misc/csplit: Check for proper handling of flags, with %0#6.3x. Coreutils 8.6 mishandles this somewhat-weird example.
Diffstat (limited to 'doc')
-rw-r--r--doc/coreutils.texi3
1 files changed, 2 insertions, 1 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 8dfb069c0..ce56b0e5e 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -3082,7 +3082,8 @@ specified, the suffix string must include exactly one
@code{printf(3)}-style conversion specification, possibly including
format specification flags, a field width, a precision specifications,
or all of these kinds of modifiers. The format letter must convert a
-binary integer argument to readable form; thus, only @samp{d}, @samp{i},
+binary unsigned integer argument to readable form. The format letters
+@samp{d} and @samp{i} are aliases for @samp{u}, and the
@samp{u}, @samp{o}, @samp{x}, and @samp{X} conversions are allowed. The
entire @var{suffix} is given (with the current output file number) to
@code{sprintf(3)} to form the file name suffixes for each of the