snprintf: port snprintf (NULL, 0, ...) to Solaris 8 and 9
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 21 Dec 2010 09:15:32 +0000 (01:15 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 21 Dec 2010 09:16:06 +0000 (01:16 -0800)
commit5ab02c057ac6c4039991e48fdf957449b7254eb4
tree6b72c70cbf10e6d755159d1862212c815cb6542e
parentd11de3302086268ee41416ec650fd90536ac5cf6
snprintf: port snprintf (NULL, 0, ...) to Solaris 8 and 9

This fixes a problem observed with the latest coreutils snapshot
that caused a test to fail on Solaris 8.  src/csplit.c's call
snprintf (NULL, 0, format, UINT_MAX) returns -1 on Solaris 9 and
earlier, instead of returning the number of bytes that would have
been generated; this causes csplit to incorrectly report memory
exhaustion.
* m4/printf.m4 (gl_SNPRINTF_RETVAL_C99): Also check for
snprintf (NULL, 0, ...) and (for good measure) snprintf (buf, 0, ...).
Guess that it doesn't work on Solaris 2.6 through 9.  Adjust
comments to match.
(gl_PRINTF_SIZES_C99, gl_PRINTF_DIRECTIVE_F, gl_SNPRINTF_RETVAL_C99):
Fix typo in matching older versions of Solaris: "solaris2.10"
is matched by the shell pattern "solaris2.[0-9]*".  This matters
only for guessing while cross-compiling.
* m4/snprintf.m4 (gl_FUNC_SNPRINTF): Also check gl_SNPRINTF_RETVAL_C99.
ChangeLog
m4/printf.m4
m4/snprintf.m4