]> Savannah Git Hosting - gnulib.git/commitdiff
*printf-posix: Work around bug with %lc of 0 on many platforms.
authorBruno Haible <bruno@clisp.org>
Tue, 21 Mar 2023 14:49:06 +0000 (15:49 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 21 Mar 2023 14:58:04 +0000 (15:58 +0100)
* 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.

33 files changed:
ChangeLog
doc/glibc-functions/asprintf.texi
doc/glibc-functions/obstack_printf.texi
doc/glibc-functions/obstack_vprintf.texi
doc/glibc-functions/vasprintf.texi
doc/posix-functions/dprintf.texi
doc/posix-functions/fprintf.texi
doc/posix-functions/printf.texi
doc/posix-functions/snprintf.texi
doc/posix-functions/sprintf.texi
doc/posix-functions/vdprintf.texi
doc/posix-functions/vfprintf.texi
doc/posix-functions/vprintf.texi
doc/posix-functions/vsnprintf.texi
doc/posix-functions/vsprintf.texi
lib/vasnprintf.c
m4/dprintf-posix.m4
m4/fprintf-posix.m4
m4/obstack-printf-posix.m4
m4/printf.m4
m4/snprintf-posix.m4
m4/sprintf-posix.m4
m4/vasnprintf-posix.m4
m4/vasnprintf.m4
m4/vasprintf-posix.m4
m4/vdprintf-posix.m4
m4/vfprintf-posix.m4
m4/vsnprintf-posix.m4
m4/vsprintf-posix.m4
tests/test-snprintf-posix.h
tests/test-sprintf-posix.h
tests/test-vasnprintf-posix.c
tests/test-vasprintf-posix.c

index 1aeb66cdfd0858cf7927808ec49de6121dc4fadf..8aad539d3e5d08b4345d7c3bd57afa8c1c1d93c4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,46 @@
+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
index 47708c40fb853f9ac7defb7f6905f2b1fe7ab771..70de08dd1c772aa8a06974f36db995d0b12287a9 100644 (file)
@@ -71,6 +71,10 @@ printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 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
index 7feae78b36dce5a28381e5aa5594f0ddc435fc34..8b13e1296e9bdd88a5b9e1ce7718a62029444a78 100644 (file)
@@ -77,6 +77,10 @@ This function does not support precisions larger than 512 or 1024 in integer,
 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
index cdded1022185d7fc21174312c8a59cd4cb27d34c..2ea59ef4fa7f3418b8ca3c8bfae7e9b4383a0b58 100644 (file)
@@ -77,6 +77,10 @@ This function does not support precisions larger than 512 or 1024 in integer,
 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
index 2f69df8e789e4340b51a7eabe172d7a315dccc0b..ef1be6bb88240a5630275e7c918039fcd1232ddd 100644 (file)
@@ -71,6 +71,10 @@ printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 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
index 7d5aeb9051f86f470d2bcc2d28526f28bfc58fb7..09e308c33b0889f29d8da31a95a4591b372f19fd 100644 (file)
@@ -44,6 +44,10 @@ Solaris 11.4.
 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:
index eedd9babbfb741c596ec9bf9fc1d2b114430bcb1..513777c0a48d209693b0e643a60d1f3c8e65a242 100644 (file)
@@ -69,6 +69,10 @@ This function mishandles large floating point precisions
 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
index c32881c2ccb6f4efa83170c78feaef47aa471d5d..8a3971aa30466d48a94bf724105d49a48ab72a46 100644 (file)
@@ -69,6 +69,10 @@ This function mishandles large floating point precisions
 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
index 6d8453b9fe48f467002f525f278eec4059409f0b..9ea76cfa8ba017492fe7dc732987263d6f35a241 100644 (file)
@@ -80,6 +80,10 @@ This function mishandles large floating point precisions
 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
index 8974498ebf7ede6c1e87ff7c7a9c844dac65a4cb..57c42c294dfc03b09c5dd92566cc81b51809c094 100644 (file)
@@ -69,6 +69,10 @@ This function mishandles large floating point precisions
 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
index d4de64ee2558b6d3d1f1df4a035b874fe4bcf415..d533d32892d29dd332c593397443c494ac2c0350 100644 (file)
@@ -44,6 +44,10 @@ Solaris 11.4.
 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:
index f3ec56b5a6e2d1a4ea4bc26bfd4d31914b1c1c63..252ac10e2b3635b88ed0d2b6e414e0c216b8d014 100644 (file)
@@ -69,6 +69,10 @@ This function mishandles large floating point precisions
 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
index 6e05d41002847246f678f35fbfb5fdbbb67b20a5..8272e50fd95a8278b1bd584db2a955e4e4962414 100644 (file)
@@ -69,6 +69,10 @@ This function mishandles large floating point precisions
 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
index 660ccfb1c36c2872e6a23e4530b01cff899dcd4e..3531644660ffd886778746ac65ecd7cadd90cd0b 100644 (file)
@@ -73,6 +73,10 @@ This function mishandles large floating point precisions
 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
index 8af4bdf279f8c0d85a783eec98ee1e382286e602..27ec5b91418263da0d6933ea72321a28651edcf8 100644 (file)
@@ -69,6 +69,10 @@ This function mishandles large floating point precisions
 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
index 2150bead4d8301feb96ec51d7811fb18c10624df..0b349f4b55341815b136d458de2e2f965c10fa4a 100644 (file)
@@ -289,7 +289,7 @@ local_wcsnlen (const wchar_t *s, size_t maxlen)
 # 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)
@@ -3017,12 +3017,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 # 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;
index 4186ab70fe3284dfc47ded56fe49814a0786fcde..eb8bd634f861103367ed4b060b98a1fd3177c250 100644 (file)
@@ -1,4 +1,4 @@
-# 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,
@@ -15,6 +15,7 @@ AC_DEFUN([gl_FUNC_DPRINTF_POSIX],
   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])
@@ -42,21 +43,25 @@ AC_DEFUN([gl_FUNC_DPRINTF_POSIX],
                                   *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
                                                             ;;
@@ -96,6 +101,7 @@ AC_DEFUN([gl_FUNC_DPRINTF_POSIX],
     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
index 5602000e4a6dbff9af971f0d3eddbf7f4ec2dcf2..1eb669fd5de6d70b7efde820440f1a6a0cc04f4a 100644 (file)
@@ -1,4 +1,4 @@
-# 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,
@@ -15,6 +15,7 @@ AC_DEFUN([gl_FUNC_FPRINTF_POSIX],
   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])
@@ -40,21 +41,25 @@ AC_DEFUN([gl_FUNC_FPRINTF_POSIX],
                                 *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
                                                           ;;
@@ -93,6 +98,7 @@ AC_DEFUN([gl_FUNC_FPRINTF_POSIX],
     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
index 633b01744274bec7e7e9710d1f28b80334c51b26..8092119906d061273a392106e9fd85206f8567c7 100644 (file)
@@ -1,4 +1,4 @@
-# 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,
@@ -18,6 +18,7 @@ AC_DEFUN([gl_FUNC_OBSTACK_PRINTF_POSIX],
   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])
@@ -45,21 +46,25 @@ AC_DEFUN([gl_FUNC_OBSTACK_PRINTF_POSIX],
                                   *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
                                                             ;;
@@ -99,6 +104,7 @@ AC_DEFUN([gl_FUNC_OBSTACK_PRINTF_POSIX],
     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
index 719679c3625cc939cc3029e0ffddcd26cff97a93..1096b87dc21eec0f469944b42cf235a413655906 100644 (file)
@@ -1,4 +1,4 @@
-# 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,
@@ -873,6 +873,53 @@ changequote([,])dnl
     ])
 ])
 
+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.
@@ -1696,18 +1743,19 @@ dnl 6 = gl_PRINTF_DIRECTIVE_B
 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...
@@ -1718,57 +1766,61 @@ dnl 6 = checking whether printf supports the 'b' directive...
 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                 #  #  #  #  #  #  #  .  .  ?  #  #  .  #  #  ?  .  #  #  #  .  .
index 033e1916e5db82fa8157a01acc7f5bdd3770cb53..1a0147f3b6e4d1d3c80a9219b4be82f1f5e36adf 100644 (file)
@@ -1,4 +1,4 @@
-# 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,
@@ -15,6 +15,7 @@ AC_DEFUN([gl_FUNC_SNPRINTF_POSIX],
   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])
@@ -47,31 +48,35 @@ AC_DEFUN([gl_FUNC_SNPRINTF_POSIX],
                                   *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
                                                                                 ;;
@@ -121,6 +126,7 @@ AC_DEFUN([gl_FUNC_SNPRINTF_POSIX],
     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
index cfcbe37ccecb66f906ca6a6af9884d52f0fcd6a1..96d0e0dacc9a8a4977c8e1f5acc5bc775b7e22b5 100644 (file)
@@ -1,4 +1,4 @@
-# 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,
@@ -15,6 +15,7 @@ AC_DEFUN([gl_FUNC_SPRINTF_POSIX],
   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])
@@ -40,21 +41,25 @@ AC_DEFUN([gl_FUNC_SPRINTF_POSIX],
                                 *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
                                                           ;;
@@ -93,6 +98,7 @@ AC_DEFUN([gl_FUNC_SPRINTF_POSIX],
     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
index 4983dfc50a89ee6e1f8e3cbcf7a768fff68c0b79..d061d3136e7c0f01ab07eaa5d4c2192d60e5dc5d 100644 (file)
@@ -1,4 +1,4 @@
-# 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,
@@ -15,6 +15,7 @@ AC_DEFUN([gl_FUNC_VASNPRINTF_POSIX],
   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])
@@ -41,23 +42,27 @@ AC_DEFUN([gl_FUNC_VASNPRINTF_POSIX],
                                 *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
                                                           ;;
@@ -96,6 +101,7 @@ AC_DEFUN([gl_FUNC_VASNPRINTF_POSIX],
     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
index f807e4771f27587824fc3ae4e323196ccf816832..26ed82a731cd0c6184d3a1a33f47746f00bf10bd 100644 (file)
@@ -1,4 +1,4 @@
-# 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,
@@ -228,6 +228,21 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LS],
   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],
 [
@@ -327,6 +342,7 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS],
   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
index 1537ad52d9e23593a9c027be2eeee309b9748da5..aa879de7115692431a656e8163960da26680f6a9 100644 (file)
@@ -1,4 +1,4 @@
-# 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,
@@ -15,6 +15,7 @@ AC_DEFUN([gl_FUNC_VASPRINTF_POSIX],
   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])
@@ -41,23 +42,27 @@ AC_DEFUN([gl_FUNC_VASPRINTF_POSIX],
                                 *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
                                                           ;;
@@ -96,6 +101,7 @@ AC_DEFUN([gl_FUNC_VASPRINTF_POSIX],
     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
index eb9ab8c6798310d95ccfb56f40ad1218c1a4f929..ff74fdaab4cd138f8f3fb4d9e97b8991b46a94be 100644 (file)
@@ -1,4 +1,4 @@
-# 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,
@@ -15,6 +15,7 @@ AC_DEFUN([gl_FUNC_VDPRINTF_POSIX],
   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])
@@ -42,21 +43,25 @@ AC_DEFUN([gl_FUNC_VDPRINTF_POSIX],
                                   *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
                                                             ;;
@@ -96,6 +101,7 @@ AC_DEFUN([gl_FUNC_VDPRINTF_POSIX],
     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
index 17a8bad843999eb3fc346568ecf3011a73f1c8bd..f248292cc4835f25aac2f4b9801fd8b923fd485a 100644 (file)
@@ -1,4 +1,4 @@
-# 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,
@@ -15,6 +15,7 @@ AC_DEFUN([gl_FUNC_VFPRINTF_POSIX],
   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])
@@ -40,21 +41,25 @@ AC_DEFUN([gl_FUNC_VFPRINTF_POSIX],
                                 *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
                                                           ;;
@@ -93,6 +98,7 @@ AC_DEFUN([gl_FUNC_VFPRINTF_POSIX],
     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
index 65805522d4684952a579920a395dfd4c4c7b74cf..d1e1933aa3dff27b26eef3c893c5d6a9d44aa2a0 100644 (file)
@@ -1,4 +1,4 @@
-# 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,
@@ -15,6 +15,7 @@ AC_DEFUN([gl_FUNC_VSNPRINTF_POSIX],
   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])
@@ -48,31 +49,35 @@ AC_DEFUN([gl_FUNC_VSNPRINTF_POSIX],
                                   *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
                                                                                 ;;
@@ -122,6 +127,7 @@ AC_DEFUN([gl_FUNC_VSNPRINTF_POSIX],
     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
index 716f58f761d3a9697eef2699d6222b1e77fed6c7..94ef61e9dd37bd7bff5804548a4acba0f16aa95b 100644 (file)
@@ -1,4 +1,4 @@
-# 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,
@@ -15,6 +15,7 @@ AC_DEFUN([gl_FUNC_VSPRINTF_POSIX],
   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])
@@ -40,21 +41,25 @@ AC_DEFUN([gl_FUNC_VSPRINTF_POSIX],
                                 *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
                                                           ;;
@@ -93,6 +98,7 @@ AC_DEFUN([gl_FUNC_VSPRINTF_POSIX],
     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
index 579d34583dff7954a69a401556c584ad2f414597..05c7be8059181247cac0b84f0cdc81e415a2ed16 100644 (file)
@@ -3024,6 +3024,22 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
     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';
 
@@ -3054,6 +3070,25 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
     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
index 863d084b99312f573711b480f4731fb20f190f65..d745a1109ba5af025e903c2e6044e53ee1c25fa9 100644 (file)
@@ -3006,6 +3006,20 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
     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';
 
@@ -3036,6 +3050,23 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
     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
index c6e1e2f6505088e40069f6b4973016a34cd6ca23..ecbb8bcda009e3cbfef9dd4f1daa20dbe42044c8 100644 (file)
@@ -3932,6 +3932,26 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
     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';
 
@@ -3974,6 +3994,27 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
     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
index 13b3a1bca9573e2b5bd10de96d08eb26b3548bb6..46086ef2512e716da29b0e3324f723078e38d2f9 100644 (file)
@@ -3873,6 +3873,24 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
     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';
 
@@ -3915,6 +3933,27 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
     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