+2010-12-21 Paul Eggert <eggert@cs.ucla.edu>
+
+ 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.
+
2010-12-20 Paul Eggert <eggert@cs.ucla.edu>
ftoastr: fix comment again
gl_cv_func_printf_sizes_c99="guessing no";;
openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
# Guess yes on Solaris >= 2.10.
- solaris2.[0-9]*) gl_cv_func_printf_sizes_c99="guessing no";;
- solaris*) gl_cv_func_printf_sizes_c99="guessing yes";;
+ solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";;
+ solaris*) gl_cv_func_printf_sizes_c99="guessing no";;
# Guess yes on NetBSD >= 3.
netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
gl_cv_func_printf_sizes_c99="guessing no";;
darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";;
darwin*) gl_cv_func_printf_directive_f="guessing yes";;
# Guess yes on Solaris >= 2.10.
- solaris2.[0-9]*) gl_cv_func_printf_directive_f="guessing no";;
- solaris*) gl_cv_func_printf_directive_f="guessing yes";;
+ solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";;
+ solaris*) gl_cv_func_printf_sizes_c99="guessing no";;
# If we don't know, assume the worst.
*) gl_cv_func_printf_directive_f="guessing no";;
esac
strcpy (buf, "ABCDEF");
if (snprintf (buf, 3, "%d %d", 4567, 89) != 7)
return 1;
+ if (snprintf (buf, 0, "%d %d", 4567, 89) != 7)
+ return 2;
+ if (snprintf (NULL, 0, "%d %d", 4567, 89) != 7)
+ return 3;
return 0;
}]])],
[gl_cv_func_snprintf_retval_c99=yes],
openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
gl_cv_func_snprintf_retval_c99="guessing no";;
openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on Solaris >= 2.6.
- solaris2.[0-5]*) gl_cv_func_snprintf_retval_c99="guessing no";;
- solaris*) gl_cv_func_snprintf_retval_c99="guessing yes";;
+ # Guess yes on Solaris >= 2.10.
+ solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";;
+ solaris*) gl_cv_func_printf_sizes_c99="guessing no";;
# Guess yes on AIX >= 4.
aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";;
aix*) gl_cv_func_snprintf_retval_c99="guessing yes";;
dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . .
dnl Solaris 11 2010-11 . . # # # . . # . . . # . . . . . . . .
dnl Solaris 10 . . # # # . . # . . . # # . . . . . . .
-dnl Solaris 2.6 ... 9 # . # # # # . # . . . # . . . . . . . .
+dnl Solaris 2.6 ... 9 # . # # # # . # . . . # . . . . # . . .
dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # #
dnl AIX 5.2, 7.1 . . # # # . . . . . . # . . . . . . . .
-dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . . . . .
+dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . # . . .
dnl HP-UX 11.31 . . . . # . . . . . . # . . . . # # . .
dnl HP-UX 11.{00,11,23} # . . . # # . . . . . # . . . . # # . #
dnl HP-UX 10.20 # . # . # # . ? . . # # . . . . # # ? #
dnl NetBSD 5.0 . . . # # . . . . . . # . # . . . . . .
dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ?
dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . .
-dnl Haiku . . . # # # . # . . . . . ? . . . . . .
-dnl BeOS # # . # # # . ? # . ? . # ? . . . . . .
+dnl Haiku . . . # # # . # . . . . . ? . . ? . . .
+dnl BeOS # # . # # # . ? # . ? . # ? . . ? . . .
dnl mingw # # # # # # . . # # . # # ? . # # # . .