+2023-03-21 Bruno Haible <bruno@clisp.org>
+
+ *printf-posix: Work around bug with %lc of 0 on many platforms.
+ * lib/vasnprintf.c (local_wctomb): Define also for
+ NEED_PRINTF_DIRECTIVE_LC.
+ (VASNPRINTF): Implement %lc handling ourselves if
+ NEED_PRINTF_DIRECTIVE_LC.
+ * m4/printf.m4 (gl_PRINTF_DIRECTIVE_LC): New macro.
+ * m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_DIRECTIVE_LC): New macro.
+ (gl_PREREQ_VASNPRINTF_WITH_EXTRAS): Invoke it.
+ * m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_POSIX): Require
+ gl_PRINTF_DIRECTIVE_LC and test its result. Invoke
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_LC.
+ * m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_POSIX): Likewise.
+ * m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_POSIX): Likewise.
+ * m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_POSIX): Likewise.
+ * m4/sprintf-posix.m4 (gl_FUNC_SPRINTF_POSIX): Likewise.
+ * m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_POSIX): Likewise.
+ * m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_POSIX): Likewise.
+ * m4/vdprintf-posix.m4 (gl_FUNC_VDPRINTF_POSIX): Likewise.
+ * m4/vfprintf-posix.m4 (gl_FUNC_VFPRINTF_POSIX): Likewise.
+ * m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_POSIX): Likewise.
+ * m4/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_POSIX): Likewise.
+ * tests/test-snprintf-posix.h (test_function): Add more tests for the
+ %c and %lc directives.
+ * tests/test-sprintf-posix.h (test_function): Likewise.
+ * tests/test-vasnprintf-posix.c (test_function): Likewise.
+ * tests/test-vasprintf-posix.c (test_function): Likewise.
+ * doc/glibc-functions/asprintf.texi: Mention the %lc 0 bug.
+ * doc/glibc-functions/obstack_printf.texi: Likewise.
+ * doc/glibc-functions/obstack_vprintf.texi: Likewise.
+ * doc/glibc-functions/vasprintf.texi: Likewise.
+ * doc/posix-functions/dprintf.texi: Likewise.
+ * doc/posix-functions/fprintf.texi: Likewise.
+ * doc/posix-functions/printf.texi: Likewise.
+ * doc/posix-functions/snprintf.texi: Likewise.
+ * doc/posix-functions/sprintf.texi: Likewise.
+ * doc/posix-functions/vdprintf.texi: Likewise.
+ * doc/posix-functions/vfprintf.texi: Likewise.
+ * doc/posix-functions/vprintf.texi: Likewise.
+ * doc/posix-functions/vsnprintf.texi: Likewise.
+ * doc/posix-functions/vsprintf.texi: Likewise.
+
2023-03-21 Ar Rakin <rakinar2@onesoftnet.eu.org> (tiny change)
gnupload: correct SFTP connection URL
with zeroes) on some platforms:
Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, Solaris 11.0, Cygwin 1.5.x.
@item
+This function produces wrong output for the @samp{lc} directive with a NUL
+wide character argument on some platforms:
+glibc 2.35, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
+@item
This function can crash in out-of-memory conditions on some platforms:
FreeBSD 13.0, NetBSD 5.0.
@end itemize
floating-point and pointer output on some platforms:
Solaris 10/x86, mingw, MSVC/clang.
@item
+This function produces wrong output for the @samp{lc} directive with a NUL
+wide character argument on some platforms:
+glibc 2.35, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
+@item
This function can crash in out-of-memory conditions on some platforms:
FreeBSD 13.0, NetBSD 5.0.
@item
floating-point and pointer output on some platforms:
Solaris 10/x86, mingw, MSVC/clang.
@item
+This function produces wrong output for the @samp{lc} directive with a NUL
+wide character argument on some platforms:
+glibc 2.35, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
+@item
This function can crash in out-of-memory conditions on some platforms:
FreeBSD 13.0, NetBSD 5.0.
@item
with zeroes) on some platforms:
Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, Solaris 11.0, Cygwin 1.5.x.
@item
+This function produces wrong output for the @samp{lc} directive with a NUL
+wide character argument on some platforms:
+glibc 2.35, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
+@item
This function can crash in out-of-memory conditions on some platforms:
FreeBSD 13.0, NetBSD 5.0.
@end itemize
This function does not support precisions larger than 512 or 1024 in integer,
floating-point and pointer output on some platforms:
AIX 7.1.
+@item
+This function produces wrong output for the @samp{lc} directive with a NUL
+wide character argument on some platforms:
+glibc 2.35, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
@end itemize
Portability problems not fixed by Gnulib:
on some platforms:
Solaris 10.
@item
+This function produces wrong output for the @samp{lc} directive with a NUL
+wide character argument on some platforms:
+glibc 2.35, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
+@item
This function can crash in out-of-memory conditions on some platforms:
FreeBSD 13.0, NetBSD 5.0.
@end itemize
on some platforms:
Solaris 10.
@item
+This function produces wrong output for the @samp{lc} directive with a NUL
+wide character argument on some platforms:
+glibc 2.35, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
+@item
This function can crash in out-of-memory conditions on some platforms:
FreeBSD 13.0, NetBSD 5.0.
@end itemize
on some platforms:
Solaris 10.
@item
+This function produces wrong output for the @samp{lc} directive with a NUL
+wide character argument on some platforms:
+glibc 2.35, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
+@item
This function can crash in out-of-memory conditions on some platforms:
FreeBSD 13.0, NetBSD 5.0.
@item
on some platforms:
Solaris 10.
@item
+This function produces wrong output for the @samp{lc} directive with a NUL
+wide character argument on some platforms:
+glibc 2.35, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
+@item
This function can crash in out-of-memory conditions on some platforms:
FreeBSD 13.0, NetBSD 5.0.
@item
This function does not support precisions larger than 512 or 1024 in integer,
floating-point and pointer output on some platforms:
AIX 7.1.
+@item
+This function produces wrong output for the @samp{lc} directive with a NUL
+wide character argument on some platforms:
+glibc 2.35, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
@end itemize
Portability problems not fixed by Gnulib:
on some platforms:
Solaris 10.
@item
+This function produces wrong output for the @samp{lc} directive with a NUL
+wide character argument on some platforms:
+glibc 2.35, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
+@item
This function can crash in out-of-memory conditions on some platforms:
FreeBSD 13.0, NetBSD 5.0.
@end itemize
on some platforms:
Solaris 10.
@item
+This function produces wrong output for the @samp{lc} directive with a NUL
+wide character argument on some platforms:
+glibc 2.35, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
+@item
This function can crash in out-of-memory conditions on some platforms:
FreeBSD 13.0, NetBSD 5.0.
@end itemize
on some platforms:
Solaris 10.
@item
+This function produces wrong output for the @samp{lc} directive with a NUL
+wide character argument on some platforms:
+glibc 2.35, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
+@item
This function can crash in out-of-memory conditions on some platforms:
FreeBSD 13.0, NetBSD 5.0.
@item
on some platforms:
Solaris 10.
@item
+This function produces wrong output for the @samp{lc} directive with a NUL
+wide character argument on some platforms:
+glibc 2.35, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
+@item
This function can crash in out-of-memory conditions on some platforms:
FreeBSD 13.0, NetBSD 5.0.
@item
# endif
#endif
-#if (((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS || ENABLE_WCHAR_FALLBACK) && HAVE_WCHAR_T) || (ENABLE_WCHAR_FALLBACK && HAVE_WINT_T)) && !WIDE_CHAR_VERSION
+#if (((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS || ENABLE_WCHAR_FALLBACK) && HAVE_WCHAR_T) || ((NEED_PRINTF_DIRECTIVE_LC || ENABLE_WCHAR_FALLBACK) && HAVE_WINT_T)) && !WIDE_CHAR_VERSION
# if ENABLE_WCHAR_FALLBACK
static size_t
wctomb_fallback (char *s, wchar_t wc)
# endif
}
#endif
-#if ENABLE_WCHAR_FALLBACK && HAVE_WINT_T && !WIDE_CHAR_VERSION
+#if (NEED_PRINTF_DIRECTIVE_LC || ENABLE_WCHAR_FALLBACK) && HAVE_WINT_T && !WIDE_CHAR_VERSION
else if (dp->conversion == 'c'
&& a.arg[dp->arg_index].type == TYPE_WIDE_CHAR)
{
/* Implement the 'lc' directive ourselves, in order to provide
- the fallback that avoids EILSEQ. */
+ a correct behaviour for the null wint_t argument and/or the
+ fallback that avoids EILSEQ. */
int flags = dp->flags;
int has_width;
size_t width;
-# dprintf-posix.m4 serial 4
+# dprintf-posix.m4 serial 5
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC])
AC_REQUIRE([gl_PRINTF_POSITIONS])
AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_lc" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- # dprintf exists and is
- # already POSIX compliant.
- gl_cv_func_dprintf_posix=yes
+ case "$gl_cv_func_printf_enomem" in
+ *yes)
+ # dprintf exists and is
+ # already POSIX compliant.
+ gl_cv_func_dprintf_posix=yes
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_LC
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
gl_PREREQ_VASNPRINTF_FLAG_ZERO
-# fprintf-posix.m4 serial 15
+# fprintf-posix.m4 serial 16
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC])
AC_REQUIRE([gl_PRINTF_POSITIONS])
AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_lc" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- # fprintf exists and is
- # already POSIX compliant.
- gl_cv_func_fprintf_posix=yes
+ case "$gl_cv_func_printf_enomem" in
+ *yes)
+ # fprintf exists and is
+ # already POSIX compliant.
+ gl_cv_func_fprintf_posix=yes
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_LC
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
gl_PREREQ_VASNPRINTF_FLAG_ZERO
-# obstack-printf-posix.m4 serial 5
+# obstack-printf-posix.m4 serial 6
dnl Copyright (C) 2008-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC])
AC_REQUIRE([gl_PRINTF_POSITIONS])
AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_lc" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- # obstack_printf exists and is
- # already POSIX compliant.
- gl_cv_func_obstack_printf_posix=yes
+ case "$gl_cv_func_printf_enomem" in
+ *yes)
+ # obstack_printf exists and is
+ # already POSIX compliant.
+ gl_cv_func_obstack_printf_posix=yes
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_LC
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
gl_PREREQ_VASNPRINTF_FLAG_ZERO
-# printf.m4 serial 75
+# printf.m4 serial 76
dnl Copyright (C) 2003, 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
])
])
+dnl Test whether the *printf family of functions supports the %lc format
+dnl directive and in particular, when the argument is a null wide character,
+dnl whether the functions don't produce a NUL byte.
+dnl Result is gl_cv_func_printf_directive_lc.
+
+AC_DEFUN([gl_PRINTF_DIRECTIVE_LC],
+[
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+ AC_CACHE_CHECK([whether printf supports the 'lc' directive correctly],
+ [gl_cv_func_printf_directive_lc],
+ [
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <wchar.h>
+#include <string.h>
+int main ()
+{
+ int result = 0;
+ char buf[100];
+ /* This test fails on glibc 2.35, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+ macOS 12.5, AIX 7.2, Solaris 11.4.
+ glibc 2.35 bug: <https://sourceware.org/bugzilla/show_bug.cgi?id=30257> */
+ {
+ buf[0] = '\0';
+ if (sprintf (buf, "%lc%lc%lc", (wint_t) 'a', (wint_t) 0, (wint_t) 'z') < 0
+ || strcmp (buf, "az") != 0)
+ result |= 1;
+ }
+ return result;
+}]])],
+ [gl_cv_func_printf_directive_lc=yes],
+ [gl_cv_func_printf_directive_lc=no],
+ [
+changequote(,)dnl
+ case "$host_os" in
+ # Guess yes on musl libc.
+ *-musl* | midipix*) gl_cv_func_printf_directive_lc="guessing yes";;
+ # Guess no otherwise.
+ *) gl_cv_func_printf_directive_lc="guessing no";;
+ esac
+changequote([,])dnl
+ ])
+ ])
+])
+
dnl Test whether the *printf family of functions supports POSIX/XSI format
dnl strings with positions. (POSIX:2001)
dnl Result is gl_cv_func_printf_positions.
dnl 7 = gl_PRINTF_DIRECTIVE_F
dnl 8 = gl_PRINTF_DIRECTIVE_N
dnl 9 = gl_PRINTF_DIRECTIVE_LS
-dnl 10 = gl_PRINTF_POSITIONS
-dnl 11 = gl_PRINTF_FLAG_GROUPING
-dnl 12 = gl_PRINTF_FLAG_LEFTADJUST
-dnl 13 = gl_PRINTF_FLAG_ZERO
-dnl 14 = gl_PRINTF_PRECISION
-dnl 15 = gl_PRINTF_ENOMEM
-dnl 16 = gl_SNPRINTF_PRESENCE
-dnl 17 = gl_SNPRINTF_TRUNCATION_C99
-dnl 18 = gl_SNPRINTF_RETVAL_C99
-dnl 19 = gl_SNPRINTF_DIRECTIVE_N
-dnl 20 = gl_SNPRINTF_SIZE1
-dnl 21 = gl_VSNPRINTF_ZEROSIZE_C99
+dnl 10 = gl_PRINTF_DIRECTIVE_LC
+dnl 11 = gl_PRINTF_POSITIONS
+dnl 12 = gl_PRINTF_FLAG_GROUPING
+dnl 13 = gl_PRINTF_FLAG_LEFTADJUST
+dnl 14 = gl_PRINTF_FLAG_ZERO
+dnl 15 = gl_PRINTF_PRECISION
+dnl 16 = gl_PRINTF_ENOMEM
+dnl 17 = gl_SNPRINTF_PRESENCE
+dnl 18 = gl_SNPRINTF_TRUNCATION_C99
+dnl 19 = gl_SNPRINTF_RETVAL_C99
+dnl 10 = gl_SNPRINTF_DIRECTIVE_N
+dnl 21 = gl_SNPRINTF_SIZE1
+dnl 22 = gl_VSNPRINTF_ZEROSIZE_C99
dnl
dnl 1 = checking whether printf supports size specifiers as in C99...
dnl 2 = checking whether printf supports 'long double' arguments...
dnl 7 = checking whether printf supports the 'F' directive...
dnl 8 = checking whether printf supports the 'n' directive...
dnl 9 = checking whether printf supports the 'ls' directive...
-dnl 10 = checking whether printf supports POSIX/XSI format strings with positions...
-dnl 11 = checking whether printf supports the grouping flag...
-dnl 12 = checking whether printf supports the left-adjust flag correctly...
-dnl 13 = checking whether printf supports the zero flag correctly...
-dnl 14 = checking whether printf supports large precisions...
-dnl 15 = checking whether printf survives out-of-memory conditions...
-dnl 16 = checking for snprintf...
-dnl 17 = checking whether snprintf truncates the result as in C99...
-dnl 18 = checking whether snprintf returns a byte count as in C99...
-dnl 19 = checking whether snprintf fully supports the 'n' directive...
-dnl 20 = checking whether snprintf respects a size of 1...
-dnl 21 = checking whether vsnprintf respects a zero size as in C99...
+dnl 10 = checking whether printf supports the 'lc' directive correctly...
+dnl 11 = checking whether printf supports POSIX/XSI format strings with positions...
+dnl 12 = checking whether printf supports the grouping flag...
+dnl 13 = checking whether printf supports the left-adjust flag correctly...
+dnl 14 = checking whether printf supports the zero flag correctly...
+dnl 15 = checking whether printf supports large precisions...
+dnl 16 = checking whether printf survives out-of-memory conditions...
+dnl 17 = checking for snprintf...
+dnl 18 = checking whether snprintf truncates the result as in C99...
+dnl 19 = checking whether snprintf returns a byte count as in C99...
+dnl 20 = checking whether snprintf fully supports the 'n' directive...
+dnl 21 = checking whether snprintf respects a size of 1...
+dnl 22 = checking whether vsnprintf respects a zero size as in C99...
dnl
dnl . = yes, # = no.
+checking whether snprintf truncates the result as in C99... yes
dnl
-dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
-dnl glibc 2.5 . . . . . # . . . . . . . . . . . . . . .
-dnl glibc 2.3.6 . . . . # # . . . . . . . . . . . . . . .
-dnl FreeBSD 13.0 . . . . # # . . . . . . . . # . . . . . .
-dnl FreeBSD 5.4, 6.1 . . . . # # . . . . . . # . # . . . . . .
-dnl Mac OS X 10.13.5 . . . # # # . # . . . . . . . . . . # . .
-dnl Mac OS X 10.5.8 . . . # # # . . . . . . # . . . . . . . .
-dnl Mac OS X 10.3.9 . . . . # # . . . . . . # . # . . . . . .
-dnl OpenBSD 6.0, 6.7 . . . . # # . . . . . . . . # . . . . . .
-dnl OpenBSD 3.9, 4.0 . . # # # # # . # . # . # . # . . . . . .
-dnl Cygwin 1.7.0 (2009) . . . # . # . . ? . . . . . ? . . . . . .
-dnl Cygwin 1.5.25 (2008) . . . # # # . . # . . . . . # . . . . . .
-dnl Cygwin 1.5.19 (2006) # . . # # # # . # . # . # # # . . . . . .
-dnl Solaris 11.4 . . # # # # . . # . . . # . . . . . . . .
-dnl Solaris 11.3 . . . . # # . . # . . . . . . . . . . . .
-dnl Solaris 11.0 . . # # # # . . # . . . # . . . . . . . .
-dnl Solaris 10 . . # # # # . . # . . . # # . . . . . . .
-dnl Solaris 2.6 ... 9 # . # # # # # . # . . . # # . . . # . . .
-dnl Solaris 2.5.1 # . # # # # # . # . . . # . . # # # # # #
-dnl AIX 7.1 . . # # # # . . . . . . # # . . . . . . .
-dnl AIX 5.2 . . # # # # . . . . . . # . . . . . . . .
-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 IRIX 6.5 # . # # # # # . # . . . # . . . . # . . .
-dnl OSF/1 5.1 # . # # # # # . . . . . # . . . . # . . #
-dnl OSF/1 4.0d # . # # # # # . . . . . # . . # # # # # #
-dnl NetBSD 9.0 . . . . # # . . . . . . . . . . . . . . .
-dnl NetBSD 5.0 . . . # # # . . . . . . # . # . . . . . .
-dnl NetBSD 4.0 . ? ? ? ? # ? . ? . ? ? ? ? ? . . . ? ? ?
-dnl NetBSD 3.0 . . . . # # # . ? # # ? # . # . . . . . .
-dnl Haiku . . . # # # # . # . . . . . ? . . ? . . .
-dnl BeOS # # . # # # # . ? # . ? . # ? . . ? . . .
-dnl Android 4.3 . . # # # # # # # . # . # . # . . . # . .
-dnl old mingw / msvcrt # # # # # # # . . # # . # # ? . # # # . .
-dnl MSVC 9 # # # # # # # # . # # . # # ? # # # # . .
-dnl mingw 2009-2011 . # . # . # . . . # # . . . ? . . . . . .
-dnl mingw-w64 2011 # # # # # # # . . # # . # # ? . # # # . .
+dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
+dnl musl libc 1.2.3 . . . . . # . . . . . . . . . . . . . . . .
+dnl glibc 2.35 . . . . . . . . . # . . . . . . . . . . . .
+dnl glibc 2.5 . . . . . # . . . # . . . . . . . . . . . .
+dnl glibc 2.3.6 . . . . # # . . . # . . . . . . . . . . . .
+dnl FreeBSD 13.0 . . . . # # . . . # . . . . . # . . . . . .
+dnl FreeBSD 5.4, 6.1 . . . . # # . . . # . . . # . # . . . . . .
+dnl Mac OS X 10.13.5 . . . # # # . # . # . . . . . . . . . # . .
+dnl Mac OS X 10.5.8 . . . # # # . . . # . . . # . . . . . . . .
+dnl Mac OS X 10.3.9 . . . . # # . . . # . . . # . # . . . . . .
+dnl OpenBSD 6.0, 6.7 . . . . # # . . . # . . . . . # . . . . . .
+dnl OpenBSD 3.9, 4.0 . . # # # # # . # # . # . # . # . . . . . .
+dnl Cygwin 1.7.0 (2009) . . . # . # . . ? ? . . . . . ? . . . . . .
+dnl Cygwin 1.5.25 (2008) . . . # # # . . # ? . . . . . # . . . . . .
+dnl Cygwin 1.5.19 (2006) # . . # # # # . # ? . # . # # # . . . . . .
+dnl Solaris 11.4 . . # # # # . . # # . . . # . . . . . . . .
+dnl Solaris 11.3 . . . . # # . . # # . . . . . . . . . . . .
+dnl Solaris 11.0 . . # # # # . . # # . . . # . . . . . . . .
+dnl Solaris 10 . . # # # # . . # # . . . # # . . . . . . .
+dnl Solaris 2.6 ... 9 # . # # # # # . # # . . . # # . . . # . . .
+dnl Solaris 2.5.1 # . # # # # # . # # . . . # . . # # # # # #
+dnl AIX 7.1 . . # # # # . . . # . . . # # . . . . . . .
+dnl AIX 5.2 . . # # # # . . . # . . . # . . . . . . . .
+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 IRIX 6.5 # . # # # # # . # # . . . # . . . . # . . .
+dnl OSF/1 5.1 # . # # # # # . . ? . . . # . . . . # . . #
+dnl OSF/1 4.0d # . # # # # # . . ? . . . # . . # # # # # #
+dnl NetBSD 9.0 . . . . # # . . . # . . . . . . . . . . . .
+dnl NetBSD 5.0 . . . # # # . . . # . . . # . # . . . . . .
+dnl NetBSD 4.0 . ? ? ? ? # ? . ? # . ? ? ? ? ? . . . ? ? ?
+dnl NetBSD 3.0 . . . . # # # . ? # # # ? # . # . . . . . .
+dnl Haiku . . . # # # # . # ? . . . . . ? . . ? . . .
+dnl BeOS # # . # # # # . ? ? # . ? . # ? . . ? . . .
+dnl Android 4.3 . . # # # # # # # ? . # . # . # . . . # . .
+dnl old mingw / msvcrt # # # # # # # . . ? # # . # # ? . # # # . .
+dnl MSVC 9 # # # # # # # # . ? # # . # # ? # # # # . .
+dnl mingw 2009-2011 . # . # . # . . . ? # # . . . ? . . . . . .
+dnl mingw-w64 2011 # # # # # # # . . ? # # . # # ? . # # # . .
-# snprintf-posix.m4 serial 15
+# snprintf-posix.m4 serial 16
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC])
AC_REQUIRE([gl_PRINTF_POSITIONS])
AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_lc" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- case "$gl_cv_func_snprintf_truncation_c99" in
+ case "$gl_cv_func_printf_enomem" in
*yes)
- case "$gl_cv_func_snprintf_retval_c99" in
+ case "$gl_cv_func_snprintf_truncation_c99" in
*yes)
- case "$gl_cv_func_snprintf_directive_n" in
+ case "$gl_cv_func_snprintf_retval_c99" in
*yes)
- case "$gl_cv_func_snprintf_size1" in
+ case "$gl_cv_func_snprintf_directive_n" in
*yes)
- case "$gl_cv_func_vsnprintf_zerosize_c99" in
+ case "$gl_cv_func_snprintf_size1" in
*yes)
- # snprintf exists and is
- # already POSIX compliant.
- gl_cv_func_snprintf_posix=yes
+ case "$gl_cv_func_vsnprintf_zerosize_c99" in
+ *yes)
+ # snprintf exists and is
+ # already POSIX compliant.
+ gl_cv_func_snprintf_posix=yes
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_LC
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
gl_PREREQ_VASNPRINTF_FLAG_ZERO
-# sprintf-posix.m4 serial 13
+# sprintf-posix.m4 serial 14
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC])
AC_REQUIRE([gl_PRINTF_POSITIONS])
AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_lc" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- # sprintf exists and is
- # already POSIX compliant.
- gl_cv_func_sprintf_posix=yes
+ case "$gl_cv_func_printf_enomem" in
+ *yes)
+ # sprintf exists and is
+ # already POSIX compliant.
+ gl_cv_func_sprintf_posix=yes
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_LC
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
gl_PREREQ_VASNPRINTF_FLAG_ZERO
-# vasnprintf-posix.m4 serial 14
+# vasnprintf-posix.m4 serial 15
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC])
AC_REQUIRE([gl_PRINTF_POSITIONS])
AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_lc" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- if test $ac_cv_func_vasnprintf = yes; then
- # vasnprintf exists and is
- # already POSIX compliant.
- gl_cv_func_vasnprintf_posix=yes
- fi
+ case "$gl_cv_func_printf_enomem" in
+ *yes)
+ if test $ac_cv_func_vasnprintf = yes; then
+ # vasnprintf exists and is
+ # already POSIX compliant.
+ gl_cv_func_vasnprintf_posix=yes
+ fi
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_LC
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
gl_PREREQ_VASNPRINTF_FLAG_ZERO
-# vasnprintf.m4 serial 43
+# vasnprintf.m4 serial 44
dnl Copyright (C) 2002-2004, 2006-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
esac
])
+# Extra prerequisites of lib/vasnprintf.c for supporting the 'lc' directive.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LC],
+[
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC])
+ case "$gl_cv_func_printf_directive_lc" in
+ *yes)
+ ;;
+ *)
+ AC_DEFINE([NEED_PRINTF_DIRECTIVE_LC], [1],
+ [Define if the vasnprintf implementation needs special code for
+ the 'lc' directive.])
+ ;;
+ esac
+])
+
# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag.
AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
[
gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_LC
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
gl_PREREQ_VASNPRINTF_FLAG_ZERO
-# vasprintf-posix.m4 serial 14
+# vasprintf-posix.m4 serial 15
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC])
AC_REQUIRE([gl_PRINTF_POSITIONS])
AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_lc" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- if test $ac_cv_func_vasprintf = yes; then
- # vasprintf exists and is
- # already POSIX compliant.
- gl_cv_func_vasprintf_posix=yes
- fi
+ case "$gl_cv_func_printf_enomem" in
+ *yes)
+ if test $ac_cv_func_vasprintf = yes; then
+ # vasprintf exists and is
+ # already POSIX compliant.
+ gl_cv_func_vasprintf_posix=yes
+ fi
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_LC
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
gl_PREREQ_VASNPRINTF_FLAG_ZERO
-# vdprintf-posix.m4 serial 4
+# vdprintf-posix.m4 serial 5
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC])
AC_REQUIRE([gl_PRINTF_POSITIONS])
AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_lc" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- # vdprintf exists and is
- # already POSIX compliant.
- gl_cv_func_vdprintf_posix=yes
+ case "$gl_cv_func_printf_enomem" in
+ *yes)
+ # vdprintf exists and is
+ # already POSIX compliant.
+ gl_cv_func_vdprintf_posix=yes
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_LC
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
gl_PREREQ_VASNPRINTF_FLAG_ZERO
-# vfprintf-posix.m4 serial 15
+# vfprintf-posix.m4 serial 16
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC])
AC_REQUIRE([gl_PRINTF_POSITIONS])
AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_lc" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- # vfprintf exists and is
- # already POSIX compliant.
- gl_cv_func_vfprintf_posix=yes
+ case "$gl_cv_func_printf_enomem" in
+ *yes)
+ # vfprintf exists and is
+ # already POSIX compliant.
+ gl_cv_func_vfprintf_posix=yes
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_LC
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
gl_PREREQ_VASNPRINTF_FLAG_ZERO
-# vsnprintf-posix.m4 serial 16
+# vsnprintf-posix.m4 serial 17
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC])
AC_REQUIRE([gl_PRINTF_POSITIONS])
AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_lc" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- case "$gl_cv_func_snprintf_truncation_c99" in
+ case "$gl_cv_func_printf_enomem" in
*yes)
- case "$gl_cv_func_snprintf_retval_c99" in
+ case "$gl_cv_func_snprintf_truncation_c99" in
*yes)
- case "$gl_cv_func_snprintf_directive_n" in
+ case "$gl_cv_func_snprintf_retval_c99" in
*yes)
- case "$gl_cv_func_snprintf_size1" in
+ case "$gl_cv_func_snprintf_directive_n" in
*yes)
- case "$gl_cv_func_vsnprintf_zerosize_c99" in
+ case "$gl_cv_func_snprintf_size1" in
*yes)
- # vsnprintf exists and is
- # already POSIX compliant.
- gl_cv_func_vsnprintf_posix=yes
+ case "$gl_cv_func_vsnprintf_zerosize_c99" in
+ *yes)
+ # vsnprintf exists and is
+ # already POSIX compliant.
+ gl_cv_func_vsnprintf_posix=yes
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_LC
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
gl_PREREQ_VASNPRINTF_FLAG_ZERO
-# vsprintf-posix.m4 serial 13
+# vsprintf-posix.m4 serial 14
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC])
AC_REQUIRE([gl_PRINTF_POSITIONS])
AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_lc" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- # vsprintf exists and is
- # already POSIX compliant.
- gl_cv_func_vsprintf_posix=yes
+ case "$gl_cv_func_printf_enomem" in
+ *yes)
+ # vsprintf exists and is
+ # already POSIX compliant.
+ gl_cv_func_vsprintf_posix=yes
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_LC
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
gl_PREREQ_VASNPRINTF_FLAG_ZERO
ASSERT (retval == strlen (result));
}
+ { /* Precision is ignored. */
+ int retval =
+ my_snprintf (result, sizeof (result),
+ "%.0c %d", (unsigned char) 'x', 33, 44, 55);
+ ASSERT (strcmp (result, "x 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
+ { /* NUL character. */
+ int retval =
+ my_snprintf (result, sizeof (result),
+ "a%cz %d", '\0', 33, 44, 55);
+ ASSERT (memcmp (result, "a\0z 33\0", 6 + 1) == 0);
+ ASSERT (retval == 6);
+ }
+
#if HAVE_WCHAR_T
static wint_t L_x = (wchar_t) 'x';
ASSERT (strcmp (result, "x 33") == 0);
ASSERT (retval == strlen (result));
}
+
+ { /* Precision is ignored. */
+ int retval =
+ my_snprintf (result, sizeof (result),
+ "%.0lc %d", L_x, 33, 44, 55);
+ ASSERT (strcmp (result, "x 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
+ { /* NUL character. */
+ int retval =
+ my_snprintf (result, sizeof (result),
+ "a%lcz %d", (wint_t) L'\0', 33, 44, 55);
+ /* No NUL byte between 'a' and 'z'. This is surprising, but is a
+ consequence of how POSIX:2018 and ISO C 23 specify the handling
+ of %lc. */
+ ASSERT (memcmp (result, "az 33\0", 5 + 1) == 0);
+ ASSERT (retval == 5);
+ }
#endif
/* Test the support of the 'b' conversion specifier for binary output of
ASSERT (retval == strlen (result));
}
+ { /* Precision is ignored. */
+ int retval =
+ my_sprintf (result, "%.0c %d", (unsigned char) 'x', 33, 44, 55);
+ ASSERT (strcmp (result, "x 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
+ { /* NUL character. */
+ int retval =
+ my_sprintf (result, "a%cz %d", '\0', 33, 44, 55);
+ ASSERT (memcmp (result, "a\0z 33\0", 6 + 1) == 0);
+ ASSERT (retval == 6);
+ }
+
#if HAVE_WCHAR_T
static wint_t L_x = (wchar_t) 'x';
ASSERT (strcmp (result, "x 33") == 0);
ASSERT (retval == strlen (result));
}
+
+ { /* Precision is ignored. */
+ int retval =
+ my_sprintf (result, "%.0lc %d", L_x, 33, 44, 55);
+ ASSERT (strcmp (result, "x 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
+ { /* NUL character. */
+ int retval =
+ my_sprintf (result, "a%lcz %d", (wint_t) L'\0', 33, 44, 55);
+ /* No NUL byte between 'a' and 'z'. This is surprising, but is a
+ consequence of how POSIX:2018 and ISO C 23 specify the handling
+ of %lc. */
+ ASSERT (memcmp (result, "az 33\0", 5 + 1) == 0);
+ ASSERT (retval == 5);
+ }
#endif
/* Test the support of the 'b' conversion specifier for binary output of
free (result);
}
+ { /* Precision is ignored. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length,
+ "%.0c %d", (unsigned char) 'x', 33, 44, 55);
+ ASSERT (strcmp (result, "x 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+
+ { /* NUL character. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length,
+ "a%cz %d", '\0', 33, 44, 55);
+ ASSERT (memcmp (result, "a\0z 33\0", 6 + 1) == 0);
+ ASSERT (length == 6);
+ free (result);
+ }
+
#if HAVE_WCHAR_T
static wint_t L_x = (wchar_t) 'x';
ASSERT (length == strlen (result));
free (result);
}
+
+ { /* Precision is ignored. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "%.0lc %d", L_x, 33, 44, 55);
+ ASSERT (strcmp (result, "x 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+
+ { /* NUL character. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "a%lcz %d", (wint_t) L'\0', 33, 44, 55);
+ /* No NUL byte between 'a' and 'z'. This is surprising, but is a
+ consequence of how POSIX:2018 and ISO C 23 specify the handling
+ of %lc. */
+ ASSERT (memcmp (result, "az 33\0", 5 + 1) == 0);
+ ASSERT (length == 5);
+ free (result);
+ }
#endif
/* Test the support of the 'b' conversion specifier for binary output of
free (result);
}
+ { /* Precision is ignored. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%.0c %d", (unsigned char) 'x', 33, 44, 55);
+ ASSERT (strcmp (result, "x 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
+
+ { /* NUL character. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "a%cz %d", '\0', 33, 44, 55);
+ ASSERT (memcmp (result, "a\0z 33\0", 6 + 1) == 0);
+ ASSERT (retval == 6);
+ free (result);
+ }
+
#if HAVE_WCHAR_T
static wint_t L_x = (wchar_t) 'x';
ASSERT (retval == strlen (result));
free (result);
}
+
+ { /* Precision is ignored. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%.0lc %d", L_x, 33, 44, 55);
+ ASSERT (strcmp (result, "x 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
+
+ { /* NUL character. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "a%lcz %d", (wint_t) L'\0', 33, 44, 55);
+ /* No NUL byte between 'a' and 'z'. This is surprising, but is a
+ consequence of how POSIX:2018 and ISO C 23 specify the handling
+ of %lc. */
+ ASSERT (memcmp (result, "az 33\0", 5 + 1) == 0);
+ ASSERT (retval == 5);
+ free (result);
+ }
#endif
/* Test the support of the 'b' conversion specifier for binary output of