This patch series implements new modules
     fprintf -> vfzprintf
     fzprintf -> vasnprintf
     printf -> vzprintf
     zprintf -> vfzprintf
     vfprintf -> vfzprintf
     vfzprintf -> vasnprintf
     vprintf -> vzprintf
     vzprintf -> vfzprintf
and the -posix and -gnu variants that go with them.


2024-06-30  Bruno Haible  <br...@clisp.org>

        zprintf-gnu: Add tests.
        * tests/test-zprintf-gnu.c: New file, based on tests/test-printf-gnu.c.
        * tests/test-zprintf-gnu.sh: New file, based on
        tests/test-printf-gnu.sh.
        * modules/zprintf-gnu-tests: New file.

        zprintf-gnu: New module.
        * modules/zprintf-gnu: New file.

2024-06-30  Bruno Haible  <br...@clisp.org>

        vzprintf-gnu: Add tests.
        * tests/test-printf-gnu.h (test_function): Use RETTYPE instead of 'int'.
        * tests/test-printf-gnu.c (RETTYPE): New macro.
        * tests/test-vprintf-gnu.c (RETTYPE): New macro.
        * tests/test-vzprintf-gnu.c: New file, based on
        tests/test-vprintf-gnu.c.
        * tests/test-vzprintf-gnu.sh: New file, based on
        tests/test-vprintf-gnu.sh.
        * modules/vzprintf-gnu-tests: New file.

        vzprintf-gnu: New module.
        * modules/vzprintf-gnu: New file.

2024-06-30  Bruno Haible  <br...@clisp.org>

        fzprintf-gnu: Add tests.
        * tests/test-fzprintf-gnu.c: New file, based on
        tests/test-fprintf-gnu.c.
        * tests/test-fzprintf-gnu.sh: New file, based on
        tests/test-fprintf-gnu.sh.
        * modules/fzprintf-gnu-tests: New file.

        fzprintf-gnu: New module.
        * modules/fzprintf-gnu: New file.

2024-06-30  Bruno Haible  <br...@clisp.org>

        vfzprintf-gnu: Add tests.
        * tests/test-vfzprintf-gnu.c: New file, based on
        tests/test-vfprintf-gnu.c.
        * tests/test-vfzprintf-gnu.sh: New file, based on
        tests/test-vfprintf-gnu.sh.
        * tests/test-fprintf-gnu.h: Update title.
        * modules/vfzprintf-gnu-tests: New file.

        vfzprintf-gnu: New module.
        * modules/vfzprintf-gnu: New file.

2024-06-30  Bruno Haible  <br...@clisp.org>

        zprintf-posix: Add tests.
        * tests/test-zprintf-posix.c: New file, based on
        tests/test-printf-posix.c.
        * tests/test-zprintf-posix.sh: New file, based on
        tests/test-printf-posix.sh.
        * modules/zprintf-posix-tests: New file.

        zprintf-posix: New module.
        * modules/zprintf-posix: New file.

2024-06-30  Bruno Haible  <br...@clisp.org>

        vzprintf-posix: Add tests.
        * tests/test-printf-posix.h (test_function): Use RETTYPE instead of
        'int'.
        * tests/test-printf-posix.c (RETTYPE): New macro.
        * tests/test-vprintf-posix.c (RETTYPE): New macro.
        * tests/test-xprintf-posix.c (RETTYPE): New macro.
        * tests/test-vzprintf-posix.c: New file, based on
        tests/test-vprintf-posix.c.
        * tests/test-vzprintf-posix.sh: New file, based on
        tests/test-vprintf-posix.sh.
        * modules/vzprintf-posix-tests: New file.

        vzprintf-posix: New module.
        * modules/vzprintf-posix: New file.

2024-06-30  Bruno Haible  <br...@clisp.org>

        fzprintf-posix: Add tests.
        * tests/test-fzprintf-posix.c: New file, based on
        tests/test-fprintf-posix.c.
        * tests/test-fzprintf-posix.sh: New file, based on
        tests/test-fprintf-posix.sh.
        * modules/fzprintf-posix-tests: New file.

        fzprintf-posix: New module.
        * modules/fzprintf-posix: New file.

2024-06-30  Bruno Haible  <br...@clisp.org>

        vfzprintf-posix: Add tests.
        * tests/test-vfzprintf-posix.c: New file, based on
        tests/test-vfprintf-posix.c.
        * tests/test-vfzprintf-posix.sh: New file, based on
        tests/test-vfprintf-posix.sh.
        * tests/test-fprintf-posix.h: Update title.
        * modules/vfzprintf-posix-tests: New file.

        vfzprintf-posix: New module.
        * modules/vfzprintf-posix: New file.

2024-06-30  Bruno Haible  <br...@clisp.org>

        printf-posix: Document properly.
        * lib/stdio.in.h (printf): Add specification.
        * lib/vprintf.c (printf): Remove specification.

        zprintf: New module.
        * lib/stdio.in.h (zprintf): New declaration.
        * lib/zprintf.c: New file, based on lib/vzprintf.c.
        * m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize
        GNULIB_ZPRINTF.
        * modules/stdio (Makefile.am): Substitute GNULIB_ZPRINTF.
        * modules/zprintf: New file.

2024-06-30  Bruno Haible  <br...@clisp.org>

        vprintf-posix: Document properly.
        * lib/stdio.in.h (vprintf): Add specification.
        * lib/vprintf.c (vprintf): Remove specification.

        vzprintf: New module.
        * lib/stdio.in.h (vzprintf): New declaration.
        * lib/vzprintf.c: New file, based on lib/vprintf.c.
        * m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize
        GNULIB_VZPRINTF.
        * modules/stdio (Makefile.am): Substitute GNULIB_VZPRINTF.
        * modules/vzprintf: New file.

2024-06-30  Bruno Haible  <br...@clisp.org>

        fprintf-posix: Use vfzprintf.
        * lib/stdio.in.h (fprintf): Add specification.
        * lib/fprintf.c: Don't include <stdlib.h>, vasnprintf.h.
        Include intprops.h.
        (fprintf): Implement based on vfzprintf.
        * modules/fprintf-posix (Depends-on): Add vfzprintf, intprops. Remove
        vasnprintf, free-posix.

        fzprintf: New module.
        * lib/stdio.in.h (fzprintf): New declaration.
        * lib/fzprintf.c: New file, based on lib/vfzprintf.c.
        * m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize
        GNULIB_FZPRINTF.
        * modules/stdio (Makefile.am): Substitute GNULIB_FZPRINTF.
        * modules/fzprintf: New file.

2024-06-30  Bruno Haible  <br...@clisp.org>

        vfprintf-posix: Use vfzprintf.
        * lib/stdio.in.h (vfprintf): Add specification.
        * lib/vfprintf.c: Don't include <stdlib.h>, vasnprintf.h.
        Include intprops.h.
        (vfprintf): Implement based on vfzprintf.
        * modules/vfprintf-posix (Depends-on): Add vfzprintf, intprops. Remove
        vasnprintf, free-posix.

        vfzprintf: New module.
        * lib/stdio.in.h (vfzprintf): New declaration.
        * lib/vfzprintf.c: New file, based on lib/vfprintf.c and
        lib/vdzprintf.c.
        * m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize
        GNULIB_VFZPRINTF.
        * modules/stdio (Makefile.am): Substitute GNULIB_VFZPRINTF.
        * modules/vfzprintf: New file.

>From 133fc37f5cbb6d7310844ea2b411dd845e70bb83 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 18:31:56 +0200
Subject: [PATCH 01/24] vfzprintf: New module.

* lib/stdio.in.h (vfzprintf): New declaration.
* lib/vfzprintf.c: New file, based on lib/vfprintf.c and
lib/vdzprintf.c.
* m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize
GNULIB_VFZPRINTF.
* modules/stdio (Makefile.am): Substitute GNULIB_VFZPRINTF.
* modules/vfzprintf: New file.
---
 ChangeLog         | 11 ++++++++
 lib/stdio.in.h    | 18 ++++++++++++
 lib/vfzprintf.c   | 72 +++++++++++++++++++++++++++++++++++++++++++++++
 m4/stdio_h.m4     |  3 +-
 modules/stdio     |  1 +
 modules/vfzprintf | 29 +++++++++++++++++++
 6 files changed, 133 insertions(+), 1 deletion(-)
 create mode 100644 lib/vfzprintf.c
 create mode 100644 modules/vfzprintf

diff --git a/ChangeLog b/ChangeLog
index a1c3732254..bb0e4aa50d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-06-30  Bruno Haible  <br...@clisp.org>
+
+	vfzprintf: New module.
+	* lib/stdio.in.h (vfzprintf): New declaration.
+	* lib/vfzprintf.c: New file, based on lib/vfprintf.c and
+	lib/vdzprintf.c.
+	* m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize
+	GNULIB_VFZPRINTF.
+	* modules/stdio (Makefile.am): Substitute GNULIB_VFZPRINTF.
+	* modules/vfzprintf: New file.
+
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
 	dzprintf-gnu: Add tests.
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index acbe14cc41..e4a0997919 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -1775,6 +1775,24 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
 # endif
 #endif
 
+#if @GNULIB_VFZPRINTF@
+/* Prints formatted output to stream FP.
+   Returns the number of bytes written to the stream.  Upon failure,
+   returns -1 with the stream's error indicator set.
+   Failure cause EOVERFLOW can only occur when a width > INT_MAX is used.
+   Therefore, if the format string is valid and does not use %ls/%lc
+   directives nor widths, the only possible failure causes are ENOMEM
+   and the possible failure causes from fwrite().  */
+_GL_FUNCDECL_SYS (vfzprintf, off64_t,
+                  (FILE *restrict fp,
+                   const char *restrict format, va_list args)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_SYS (vfzprintf, off64_t,
+                  (FILE *restrict fp,
+                   const char *restrict format, va_list args));
+#endif
+
 #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
 # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
      || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
diff --git a/lib/vfzprintf.c b/lib/vfzprintf.c
new file mode 100644
index 0000000000..94e71a2568
--- /dev/null
+++ b/lib/vfzprintf.c
@@ -0,0 +1,72 @@
+/* Formatted output to a stream.
+   Copyright (C) 2004, 2006-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* Specification.  */
+#include <stdio.h>
+
+#include <errno.h>
+#include <stdarg.h>
+#include <stdlib.h>
+
+#include "fseterr.h"
+#include "intprops.h"
+#include "vasnprintf.h"
+
+off64_t
+vfzprintf (FILE *fp, const char *format, va_list args)
+{
+  char buf[2000];
+  char *output;
+  size_t len;
+  size_t lenbuf = sizeof (buf);
+
+  output = vasnprintf (buf, &lenbuf, format, args);
+  len = lenbuf;
+
+  if (!output)
+    {
+      fseterr (fp);
+      return -1;
+    }
+
+  if (len > TYPE_MAXIMUM (off64_t))
+    {
+      /* We could write the (huge) output, but then could not return len, as it
+         would be negative.  Treat this case as if vasnprintf had already
+         encountered an out-of-memory situation.  */
+      if (output != buf)
+        free (output);
+      fseterr (fp);
+      errno = ENOMEM;
+      return -1;
+    }
+
+  if (fwrite (output, 1, len, fp) < len)
+    {
+      if (output != buf)
+        free (output);
+      return -1;
+    }
+
+  if (output != buf)
+    free (output);
+
+  return len;
+}
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index 126e395fae..090d5cd110 100644
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -1,5 +1,5 @@
 # stdio_h.m4
-# serial 71
+# serial 72
 dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -188,6 +188,7 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS]
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDZPRINTF])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF_POSIX])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFZPRINTF])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF_POSIX])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNPRINTF])
diff --git a/modules/stdio b/modules/stdio
index 22008a2b90..ec8cf240d6 100644
--- a/modules/stdio
+++ b/modules/stdio
@@ -121,6 +121,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
 	      -e 's/@''GNULIB_VDZPRINTF''@/$(GNULIB_VDZPRINTF)/g' \
 	      -e 's/@''GNULIB_VFPRINTF''@/$(GNULIB_VFPRINTF)/g' \
 	      -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GNULIB_VFPRINTF_POSIX)/g' \
+	      -e 's/@''GNULIB_VFZPRINTF''@/$(GNULIB_VFZPRINTF)/g' \
 	      -e 's/@''GNULIB_VFSCANF''@/$(GNULIB_VFSCANF)/g' \
 	      -e 's/@''GNULIB_VSCANF''@/$(GNULIB_VSCANF)/g' \
 	      -e 's/@''GNULIB_VPRINTF''@/$(GNULIB_VPRINTF)/g' \
diff --git a/modules/vfzprintf b/modules/vfzprintf
new file mode 100644
index 0000000000..45bafdb365
--- /dev/null
+++ b/modules/vfzprintf
@@ -0,0 +1,29 @@
+Description:
+vfzprintf() function: print formatted output (without INT_MAX limitation)
+to a stream
+
+Files:
+lib/vfzprintf.c
+
+Depends-on:
+stdio
+vasnprintf
+intprops
+free-posix
+fseterr
+errno
+
+configure.ac:
+gl_STDIO_MODULE_INDICATOR([vfzprintf])
+
+Makefile.am:
+lib_SOURCES += vfzprintf.c
+
+Include:
+<stdio.h>
+
+License:
+LGPL
+
+Maintainer:
+all
-- 
2.34.1

>From 8a3988719830bafc59c4b36c58348ea32bd6c1ce Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 18:45:25 +0200
Subject: [PATCH 02/24] vfprintf-posix: Use vfzprintf.

* lib/stdio.in.h (vfprintf): Add specification.
* lib/vfprintf.c: Don't include <stdlib.h>, vasnprintf.h.
Include intprops.h.
(vfprintf): Implement based on vfzprintf.
* modules/vfprintf-posix (Depends-on): Add vfzprintf, intprops. Remove
vasnprintf, free-posix.
---
 ChangeLog              |  8 ++++++++
 lib/stdio.in.h         |  3 +++
 lib/vfprintf.c         | 34 ++++------------------------------
 modules/vfprintf-posix |  6 +++---
 4 files changed, 18 insertions(+), 33 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bb0e4aa50d..51af63d1b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
+	vfprintf-posix: Use vfzprintf.
+	* lib/stdio.in.h (vfprintf): Add specification.
+	* lib/vfprintf.c: Don't include <stdlib.h>, vasnprintf.h.
+	Include intprops.h.
+	(vfprintf): Implement based on vfzprintf.
+	* modules/vfprintf-posix (Depends-on): Add vfzprintf, intprops. Remove
+	vasnprintf, free-posix.
+
 	vfzprintf: New module.
 	* lib/stdio.in.h (vfzprintf): New declaration.
 	* lib/vfzprintf.c: New file, based on lib/vfprintf.c and
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index e4a0997919..8802e87832 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -1794,6 +1794,9 @@ _GL_CXXALIAS_SYS (vfzprintf, off64_t,
 #endif
 
 #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
+/* Prints formatted output to stream FP.
+   Returns the number of bytes written to the stream.  Upon failure,
+   returns a negative value with the stream's error indicator set.  */
 # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
      || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
diff --git a/lib/vfprintf.c b/lib/vfprintf.c
index 4cd5cbdb68..5a87350b59 100644
--- a/lib/vfprintf.c
+++ b/lib/vfprintf.c
@@ -24,47 +24,21 @@
 #include <errno.h>
 #include <limits.h>
 #include <stdarg.h>
-#include <stdlib.h>
 
 #include "fseterr.h"
-#include "vasnprintf.h"
+#include "intprops.h"
 
-/* Print formatted output to the stream FP.
-   Return string length of formatted string.  On error, return a negative
-   value.  */
 int
 vfprintf (FILE *fp, const char *format, va_list args)
 {
-  char buf[2000];
-  char *output;
-  size_t len;
-  size_t lenbuf = sizeof (buf);
+  off64_t ret = vfzprintf (fp, format, args);
 
-  output = vasnprintf (buf, &lenbuf, format, args);
-  len = lenbuf;
-
-  if (!output)
+  if (TYPE_MAXIMUM (off64_t) > INT_MAX && ret > INT_MAX)
     {
       fseterr (fp);
-      return -1;
-    }
-
-  if (fwrite (output, 1, len, fp) < len)
-    {
-      if (output != buf)
-        free (output);
-      return -1;
-    }
-
-  if (output != buf)
-    free (output);
-
-  if (len > INT_MAX)
-    {
       errno = EOVERFLOW;
-      fseterr (fp);
       return -1;
     }
 
-  return len;
+  return ret;
 }
diff --git a/modules/vfprintf-posix b/modules/vfprintf-posix
index 3bc350d98b..aec763b2e3 100644
--- a/modules/vfprintf-posix
+++ b/modules/vfprintf-posix
@@ -18,10 +18,10 @@ stdio
 nocrash
 printf-safe
 multiarch
-free-posix         [test $REPLACE_VFPRINTF = 1]
-fseterr            [test $REPLACE_VFPRINTF = 1]
-vasnprintf         [test $REPLACE_VFPRINTF = 1]
+vfzprintf          [test $REPLACE_VFPRINTF = 1]
 mixin/printf-posix [test $REPLACE_VFPRINTF = 1]
+intprops           [test $REPLACE_VFPRINTF = 1]
+fseterr            [test $REPLACE_VFPRINTF = 1]
 errno              [test $REPLACE_VFPRINTF = 1]
 
 configure.ac:
-- 
2.34.1

>From 70eef26ae3ab9d98f6c4f9162acdf1f365a5e2f8 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 19:40:35 +0200
Subject: [PATCH 03/24] fzprintf: New module.

* lib/stdio.in.h (fzprintf): New declaration.
* lib/fzprintf.c: New file, based on lib/vfzprintf.c.
* m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize
GNULIB_FZPRINTF.
* modules/stdio (Makefile.am): Substitute GNULIB_FZPRINTF.
* modules/fzprintf: New file.
---
 ChangeLog        | 10 +++++++
 lib/fzprintf.c   | 75 ++++++++++++++++++++++++++++++++++++++++++++++++
 lib/stdio.in.h   | 16 +++++++++++
 m4/stdio_h.m4    |  3 +-
 modules/fzprintf | 29 +++++++++++++++++++
 modules/stdio    |  1 +
 6 files changed, 133 insertions(+), 1 deletion(-)
 create mode 100644 lib/fzprintf.c
 create mode 100644 modules/fzprintf

diff --git a/ChangeLog b/ChangeLog
index 51af63d1b8..bcbc7bc7c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-06-30  Bruno Haible  <br...@clisp.org>
+
+	fzprintf: New module.
+	* lib/stdio.in.h (fzprintf): New declaration.
+	* lib/fzprintf.c: New file, based on lib/vfzprintf.c.
+	* m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize
+	GNULIB_FZPRINTF.
+	* modules/stdio (Makefile.am): Substitute GNULIB_FZPRINTF.
+	* modules/fzprintf: New file.
+
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
 	vfprintf-posix: Use vfzprintf.
diff --git a/lib/fzprintf.c b/lib/fzprintf.c
new file mode 100644
index 0000000000..b8df994187
--- /dev/null
+++ b/lib/fzprintf.c
@@ -0,0 +1,75 @@
+/* Formatted output to a stream.
+   Copyright (C) 2004, 2006-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* Specification.  */
+#include <stdio.h>
+
+#include <errno.h>
+#include <stdarg.h>
+#include <stdlib.h>
+
+#include "fseterr.h"
+#include "intprops.h"
+#include "vasnprintf.h"
+
+off64_t
+fzprintf (FILE *fp, const char *format, ...)
+{
+  va_list args;
+  char buf[2000];
+  char *output;
+  size_t len;
+  size_t lenbuf = sizeof (buf);
+
+  va_start (args, format);
+  output = vasnprintf (buf, &lenbuf, format, args);
+  len = lenbuf;
+  va_end (args);
+
+  if (!output)
+    {
+      fseterr (fp);
+      return -1;
+    }
+
+  if (len > TYPE_MAXIMUM (off64_t))
+    {
+      /* We could write the (huge) output, but then could not return len, as it
+         would be negative.  Treat this case as if vasnprintf had already
+         encountered an out-of-memory situation.  */
+      if (output != buf)
+        free (output);
+      fseterr (fp);
+      errno = ENOMEM;
+      return -1;
+    }
+
+  if (fwrite (output, 1, len, fp) < len)
+    {
+      if (output != buf)
+        free (output);
+      return -1;
+    }
+
+  if (output != buf)
+    free (output);
+
+  return len;
+}
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 8802e87832..4ce51a743c 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -566,6 +566,22 @@ _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX complian
 # endif
 #endif
 
+#if @GNULIB_FZPRINTF@
+/* Prints formatted output to stream FP.
+   Returns the number of bytes written to the stream.  Upon failure,
+   returns -1 with the stream's error indicator set.
+   Failure cause EOVERFLOW can only occur when a width > INT_MAX is used.
+   Therefore, if the format string is valid and does not use %ls/%lc
+   directives nor widths, the only possible failure causes are ENOMEM
+   and the possible failure causes from fwrite().  */
+_GL_FUNCDECL_SYS (fzprintf, off64_t,
+                  (FILE *restrict fp, const char *restrict format, ...)
+                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_SYS (fzprintf, off64_t,
+                  (FILE *restrict fp, const char *restrict format, ...));
+#endif
+
 #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
 # if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
      || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index 090d5cd110..542280100a 100644
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -1,5 +1,5 @@
 # stdio_h.m4
-# serial 72
+# serial 73
 dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -154,6 +154,7 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS]
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELL])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELLO])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FWRITE])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FZPRINTF])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETC])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCHAR])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDELIM])
diff --git a/modules/fzprintf b/modules/fzprintf
new file mode 100644
index 0000000000..b822f26c59
--- /dev/null
+++ b/modules/fzprintf
@@ -0,0 +1,29 @@
+Description:
+fzprintf() function: print formatted output (without INT_MAX limitation)
+to a stream
+
+Files:
+lib/fzprintf.c
+
+Depends-on:
+stdio
+vasnprintf
+intprops
+free-posix
+fseterr
+errno
+
+configure.ac:
+gl_STDIO_MODULE_INDICATOR([fzprintf])
+
+Makefile.am:
+lib_SOURCES += fzprintf.c
+
+Include:
+<stdio.h>
+
+License:
+LGPL
+
+Maintainer:
+all
diff --git a/modules/stdio b/modules/stdio
index ec8cf240d6..a366b51a85 100644
--- a/modules/stdio
+++ b/modules/stdio
@@ -89,6 +89,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
 	      -e 's/@''GNULIB_FTELL''@/$(GNULIB_FTELL)/g' \
 	      -e 's/@''GNULIB_FTELLO''@/$(GNULIB_FTELLO)/g' \
 	      -e 's/@''GNULIB_FWRITE''@/$(GNULIB_FWRITE)/g' \
+	      -e 's/@''GNULIB_FZPRINTF''@/$(GNULIB_FZPRINTF)/g' \
 	      -e 's/@''GNULIB_GETC''@/$(GNULIB_GETC)/g' \
 	      -e 's/@''GNULIB_GETCHAR''@/$(GNULIB_GETCHAR)/g' \
 	      -e 's/@''GNULIB_GETDELIM''@/$(GNULIB_GETDELIM)/g' \
-- 
2.34.1

>From c05c76f1341d1bbb9c4cc69c6885600e763773c0 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 19:47:26 +0200
Subject: [PATCH 04/24] fprintf-posix: Use vfzprintf.

* lib/stdio.in.h (fprintf): Add specification.
* lib/fprintf.c: Don't include <stdlib.h>, vasnprintf.h.
Include intprops.h.
(fprintf): Implement based on vfzprintf.
* modules/fprintf-posix (Depends-on): Add vfzprintf, intprops. Remove
vasnprintf, free-posix.
---
 ChangeLog             |  8 ++++++++
 lib/fprintf.c         | 34 +++++-----------------------------
 lib/stdio.in.h        |  3 +++
 modules/fprintf-posix |  6 +++---
 4 files changed, 19 insertions(+), 32 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bcbc7bc7c5..8492ed8314 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
+	fprintf-posix: Use vfzprintf.
+	* lib/stdio.in.h (fprintf): Add specification.
+	* lib/fprintf.c: Don't include <stdlib.h>, vasnprintf.h.
+	Include intprops.h.
+	(fprintf): Implement based on vfzprintf.
+	* modules/fprintf-posix (Depends-on): Add vfzprintf, intprops. Remove
+	vasnprintf, free-posix.
+
 	fzprintf: New module.
 	* lib/stdio.in.h (fzprintf): New declaration.
 	* lib/fzprintf.c: New file, based on lib/vfzprintf.c.
diff --git a/lib/fprintf.c b/lib/fprintf.c
index da4609d8d6..d55f0bafcc 100644
--- a/lib/fprintf.c
+++ b/lib/fprintf.c
@@ -24,50 +24,26 @@
 #include <errno.h>
 #include <limits.h>
 #include <stdarg.h>
-#include <stdlib.h>
 
 #include "fseterr.h"
-#include "vasnprintf.h"
+#include "intprops.h"
 
-/* Print formatted output to the stream FP.
-   Return string length of formatted string.  On error, return a negative
-   value.  */
 int
 fprintf (FILE *fp, const char *format, ...)
 {
-  char buf[2000];
-  char *output;
-  size_t len;
-  size_t lenbuf = sizeof (buf);
   va_list args;
+  off64_t ret;
 
   va_start (args, format);
-  output = vasnprintf (buf, &lenbuf, format, args);
-  len = lenbuf;
+  ret = vfzprintf (fp, format, args);
   va_end (args);
 
-  if (!output)
+  if (TYPE_MAXIMUM (off64_t) > INT_MAX && ret > INT_MAX)
     {
       fseterr (fp);
-      return -1;
-    }
-
-  if (fwrite (output, 1, len, fp) < len)
-    {
-      if (output != buf)
-        free (output);
-      return -1;
-    }
-
-  if (output != buf)
-    free (output);
-
-  if (len > INT_MAX)
-    {
       errno = EOVERFLOW;
-      fseterr (fp);
       return -1;
     }
 
-  return len;
+  return ret;
 }
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 4ce51a743c..1c48954d81 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -583,6 +583,9 @@ _GL_CXXALIAS_SYS (fzprintf, off64_t,
 #endif
 
 #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
+/* Prints formatted output to stream FP.
+   Returns the number of bytes written to the stream.  Upon failure,
+   returns a negative value with the stream's error indicator set.  */
 # if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
      || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
diff --git a/modules/fprintf-posix b/modules/fprintf-posix
index 6cda1ccef7..3ccb9be175 100644
--- a/modules/fprintf-posix
+++ b/modules/fprintf-posix
@@ -19,10 +19,10 @@ nocrash
 printf-safe
 errno
 multiarch
-fseterr            [test $REPLACE_FPRINTF = 1]
-vasnprintf         [test $REPLACE_FPRINTF = 1]
+vfzprintf          [test $REPLACE_FPRINTF = 1]
 mixin/printf-posix [test $REPLACE_FPRINTF = 1]
-free-posix         [test $REPLACE_FPRINTF = 1]
+intprops           [test $REPLACE_FPRINTF = 1]
+fseterr            [test $REPLACE_FPRINTF = 1]
 
 configure.ac:
 gl_FUNC_FPRINTF_POSIX
-- 
2.34.1

>From 439f2f253413a33c973f8e139514b5aa03713d34 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 20:00:58 +0200
Subject: [PATCH 05/24] vzprintf: New module.

* lib/stdio.in.h (vzprintf): New declaration.
* lib/vzprintf.c: New file, based on lib/vprintf.c.
* m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize
GNULIB_VZPRINTF.
* modules/stdio (Makefile.am): Substitute GNULIB_VZPRINTF.
* modules/vzprintf: New file.
---
 ChangeLog        | 10 ++++++++++
 lib/stdio.in.h   | 15 +++++++++++++++
 lib/vzprintf.c   | 30 ++++++++++++++++++++++++++++++
 m4/stdio_h.m4    |  3 ++-
 modules/stdio    |  1 +
 modules/vzprintf | 25 +++++++++++++++++++++++++
 6 files changed, 83 insertions(+), 1 deletion(-)
 create mode 100644 lib/vzprintf.c
 create mode 100644 modules/vzprintf

diff --git a/ChangeLog b/ChangeLog
index 8492ed8314..755b3d4630 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-06-30  Bruno Haible  <br...@clisp.org>
+
+	vzprintf: New module.
+	* lib/stdio.in.h (vzprintf): New declaration.
+	* lib/vzprintf.c: New file, based on lib/vprintf.c.
+	* m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize
+	GNULIB_VZPRINTF.
+	* modules/stdio (Makefile.am): Substitute GNULIB_VZPRINTF.
+	* modules/vzprintf: New file.
+
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
 	fprintf-posix: Use vfzprintf.
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 1c48954d81..9ecca6a0d1 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -1884,6 +1884,21 @@ _GL_CXXALIASWARN (vfscanf);
 # endif
 #endif
 
+#if @GNULIB_VZPRINTF@
+/* Prints formatted output to standard output.
+   Returns the number of bytes written to standard output.  Upon failure,
+   returns -1 with stdout's error indicator set.
+   Failure cause EOVERFLOW can only occur when a width > INT_MAX is used.
+   Therefore, if the format string is valid and does not use %ls/%lc
+   directives nor widths, the only possible failure causes are ENOMEM
+   and the possible failure causes from fwrite().  */
+_GL_FUNCDECL_SYS (vzprintf, off64_t, (const char *restrict format, va_list args)
+                                     _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0)
+                                     _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_SYS (vzprintf, off64_t,
+                  (const char *restrict format, va_list args));
+#endif
+
 #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
 # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
      || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
diff --git a/lib/vzprintf.c b/lib/vzprintf.c
new file mode 100644
index 0000000000..5a8eef2d45
--- /dev/null
+++ b/lib/vzprintf.c
@@ -0,0 +1,30 @@
+/* Formatted output to standard output.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* Specification.  */
+#include <stdio.h>
+
+#include <stdarg.h>
+
+off64_t
+vzprintf (const char *format, va_list args)
+{
+  return vfzprintf (stdout, format, args);
+}
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index 542280100a..a0e1c3caed 100644
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -1,5 +1,5 @@
 # stdio_h.m4
-# serial 73
+# serial 74
 dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -196,6 +196,7 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS]
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNZPRINTF])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSPRINTF_POSIX])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSZPRINTF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VZPRINTF])
     dnl Support Microsoft deprecated alias function names by default.
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCLOSEALL], [1])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FDOPEN], [1])
diff --git a/modules/stdio b/modules/stdio
index a366b51a85..69ab95dd37 100644
--- a/modules/stdio
+++ b/modules/stdio
@@ -131,6 +131,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
 	      -e 's/@''GNULIB_VSNZPRINTF''@/$(GNULIB_VSNZPRINTF)/g' \
 	      -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GNULIB_VSPRINTF_POSIX)/g' \
 	      -e 's/@''GNULIB_VSZPRINTF''@/$(GNULIB_VSZPRINTF)/g' \
+	      -e 's/@''GNULIB_VZPRINTF''@/$(GNULIB_VZPRINTF)/g' \
 	      -e 's/@''GNULIB_MDA_FCLOSEALL''@/$(GNULIB_MDA_FCLOSEALL)/g' \
 	      -e 's/@''GNULIB_MDA_FDOPEN''@/$(GNULIB_MDA_FDOPEN)/g' \
 	      -e 's/@''GNULIB_MDA_FILENO''@/$(GNULIB_MDA_FILENO)/g' \
diff --git a/modules/vzprintf b/modules/vzprintf
new file mode 100644
index 0000000000..be88f208c2
--- /dev/null
+++ b/modules/vzprintf
@@ -0,0 +1,25 @@
+Description:
+vzprintf() function: print formatted output (without INT_MAX limitation)
+to standard output
+
+Files:
+lib/vzprintf.c
+
+Depends-on:
+stdio
+vfzprintf
+
+configure.ac:
+gl_STDIO_MODULE_INDICATOR([vzprintf])
+
+Makefile.am:
+lib_SOURCES += vzprintf.c
+
+Include:
+<stdio.h>
+
+License:
+LGPL
+
+Maintainer:
+all
-- 
2.34.1

>From 9128857a16e2833ffd463b2361bb59639f465231 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 20:15:58 +0200
Subject: [PATCH 06/24] vprintf-posix: Document properly.

* lib/stdio.in.h (vprintf): Add specification.
* lib/vprintf.c (vprintf): Remove specification.
---
 ChangeLog      | 4 ++++
 lib/stdio.in.h | 3 +++
 lib/vprintf.c  | 5 +----
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 755b3d4630..62041cd616 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
+	vprintf-posix: Document properly.
+	* lib/stdio.in.h (vprintf): Add specification.
+	* lib/vprintf.c (vprintf): Remove specification.
+
 	vzprintf: New module.
 	* lib/stdio.in.h (vzprintf): New declaration.
 	* lib/vzprintf.c: New file, based on lib/vprintf.c.
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 9ecca6a0d1..51876b2455 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -1900,6 +1900,9 @@ _GL_CXXALIAS_SYS (vzprintf, off64_t,
 #endif
 
 #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
+/* Prints formatted output to standard output.
+   Returns the number of bytes written to standard output.  Upon failure,
+   returns a negative value with stdout's error indicator set.  */
 # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
      || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
diff --git a/lib/vprintf.c b/lib/vprintf.c
index 751a235462..8ec4be7752 100644
--- a/lib/vprintf.c
+++ b/lib/vprintf.c
@@ -1,4 +1,4 @@
-/* Formatted output to a stream.
+/* Formatted output to standard output.
    Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
@@ -23,9 +23,6 @@
 
 #include <stdarg.h>
 
-/* Print formatted output to standard output.
-   Return string length of formatted string.  On error, return a negative
-   value.  */
 int
 vprintf (const char *format, va_list args)
 {
-- 
2.34.1

>From b11765b65676024dab0f3ac16f7a0a2cf911494f Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 20:58:29 +0200
Subject: [PATCH 07/24] zprintf: New module.

* lib/stdio.in.h (zprintf): New declaration.
* lib/zprintf.c: New file, based on lib/vzprintf.c.
* m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize
GNULIB_ZPRINTF.
* modules/stdio (Makefile.am): Substitute GNULIB_ZPRINTF.
* modules/zprintf: New file.
---
 ChangeLog       | 10 ++++++++++
 lib/stdio.in.h  | 14 ++++++++++++++
 lib/zprintf.c   | 37 +++++++++++++++++++++++++++++++++++++
 m4/stdio_h.m4   |  3 ++-
 modules/stdio   |  1 +
 modules/zprintf | 25 +++++++++++++++++++++++++
 6 files changed, 89 insertions(+), 1 deletion(-)
 create mode 100644 lib/zprintf.c
 create mode 100644 modules/zprintf

diff --git a/ChangeLog b/ChangeLog
index 62041cd616..3b6f777e85 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-06-30  Bruno Haible  <br...@clisp.org>
+
+	zprintf: New module.
+	* lib/stdio.in.h (zprintf): New declaration.
+	* lib/zprintf.c: New file, based on lib/vzprintf.c.
+	* m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize
+	GNULIB_ZPRINTF.
+	* modules/stdio (Makefile.am): Substitute GNULIB_ZPRINTF.
+	* modules/zprintf: New file.
+
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
 	vprintf-posix: Document properly.
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 51876b2455..013c7a4ad1 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -1265,6 +1265,20 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
 # endif
 #endif
 
+#if @GNULIB_ZPRINTF@
+/* Prints formatted output to standard output.
+   Returns the number of bytes written to standard output.  Upon failure,
+   returns -1 with stdout's error indicator set.
+   Failure cause EOVERFLOW can only occur when a width > INT_MAX is used.
+   Therefore, if the format string is valid and does not use %ls/%lc
+   directives nor widths, the only possible failure causes are ENOMEM
+   and the possible failure causes from fwrite().  */
+_GL_FUNCDECL_SYS (zprintf, off64_t, (const char *restrict format, ...)
+                                    _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
+                                    _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_SYS (zprintf, off64_t, (const char *restrict format, ...));
+#endif
+
 #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
 # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
      || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
diff --git a/lib/zprintf.c b/lib/zprintf.c
new file mode 100644
index 0000000000..b5a383a7c8
--- /dev/null
+++ b/lib/zprintf.c
@@ -0,0 +1,37 @@
+/* Formatted output to standard output.
+   Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* Specification.  */
+#include <stdio.h>
+
+#include <stdarg.h>
+
+off64_t
+zprintf (const char *format, ...)
+{
+  va_list args;
+  off64_t ret;
+
+  va_start (args, format);
+  ret = vfzprintf (stdout, format, args);
+  va_end (args);
+
+  return ret;
+}
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index a0e1c3caed..ec52ae92ff 100644
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -1,5 +1,5 @@
 # stdio_h.m4
-# serial 74
+# serial 75
 dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -197,6 +197,7 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS]
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSPRINTF_POSIX])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSZPRINTF])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VZPRINTF])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ZPRINTF])
     dnl Support Microsoft deprecated alias function names by default.
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCLOSEALL], [1])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FDOPEN], [1])
diff --git a/modules/stdio b/modules/stdio
index 69ab95dd37..0e6b6e4d21 100644
--- a/modules/stdio
+++ b/modules/stdio
@@ -132,6 +132,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
 	      -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GNULIB_VSPRINTF_POSIX)/g' \
 	      -e 's/@''GNULIB_VSZPRINTF''@/$(GNULIB_VSZPRINTF)/g' \
 	      -e 's/@''GNULIB_VZPRINTF''@/$(GNULIB_VZPRINTF)/g' \
+	      -e 's/@''GNULIB_ZPRINTF''@/$(GNULIB_ZPRINTF)/g' \
 	      -e 's/@''GNULIB_MDA_FCLOSEALL''@/$(GNULIB_MDA_FCLOSEALL)/g' \
 	      -e 's/@''GNULIB_MDA_FDOPEN''@/$(GNULIB_MDA_FDOPEN)/g' \
 	      -e 's/@''GNULIB_MDA_FILENO''@/$(GNULIB_MDA_FILENO)/g' \
diff --git a/modules/zprintf b/modules/zprintf
new file mode 100644
index 0000000000..d4acca6355
--- /dev/null
+++ b/modules/zprintf
@@ -0,0 +1,25 @@
+Description:
+zprintf() function: print formatted output (without INT_MAX limitation)
+to standard output
+
+Files:
+lib/zprintf.c
+
+Depends-on:
+stdio
+vfzprintf
+
+configure.ac:
+gl_STDIO_MODULE_INDICATOR([zprintf])
+
+Makefile.am:
+lib_SOURCES += zprintf.c
+
+Include:
+<stdio.h>
+
+License:
+LGPL
+
+Maintainer:
+all
-- 
2.34.1

>From b861c3acc450294108a4d942fc9c4a44d772295f Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 21:00:47 +0200
Subject: [PATCH 08/24] printf-posix: Document properly.

* lib/stdio.in.h (printf): Add specification.
* lib/vprintf.c (printf): Remove specification.
---
 ChangeLog      | 4 ++++
 lib/printf.c   | 3 ---
 lib/stdio.in.h | 3 +++
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3b6f777e85..36f4db7910 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
+	printf-posix: Document properly.
+	* lib/stdio.in.h (printf): Add specification.
+	* lib/vprintf.c (printf): Remove specification.
+
 	zprintf: New module.
 	* lib/stdio.in.h (zprintf): New declaration.
 	* lib/zprintf.c: New file, based on lib/vzprintf.c.
diff --git a/lib/printf.c b/lib/printf.c
index f89af7490e..f5305935b9 100644
--- a/lib/printf.c
+++ b/lib/printf.c
@@ -23,9 +23,6 @@
 
 #include <stdarg.h>
 
-/* Print formatted output to standard output.
-   Return string length of formatted string.  On error, return a negative
-   value.  */
 int
 printf (const char *format, ...)
 {
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 013c7a4ad1..38572382d4 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -1280,6 +1280,9 @@ _GL_CXXALIAS_SYS (zprintf, off64_t, (const char *restrict format, ...));
 #endif
 
 #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
+/* Prints formatted output to standard output.
+   Returns the number of bytes written to standard output.  Upon failure,
+   returns a negative value with stdout's error indicator set.  */
 # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
      || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
 #  if defined __GNUC__ || defined __clang__
-- 
2.34.1

>From 22289bfa955ae3952b2f74cc8bfa22ef510e4fe8 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 21:07:12 +0200
Subject: [PATCH 09/24] vfzprintf-posix: New module.

* modules/vfzprintf-posix: New file.
---
 ChangeLog               |  5 +++++
 modules/vfzprintf-posix | 22 ++++++++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 modules/vfzprintf-posix

diff --git a/ChangeLog b/ChangeLog
index 36f4db7910..981b2734e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-06-30  Bruno Haible  <br...@clisp.org>
+
+	vfzprintf-posix: New module.
+	* modules/vfzprintf-posix: New file.
+
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
 	printf-posix: Document properly.
diff --git a/modules/vfzprintf-posix b/modules/vfzprintf-posix
new file mode 100644
index 0000000000..d869d6e8a4
--- /dev/null
+++ b/modules/vfzprintf-posix
@@ -0,0 +1,22 @@
+Description:
+vfzprintf() function with POSIX compatible format string interpretation
+
+Files:
+
+Depends-on:
+vfzprintf
+mixin/printf-posix
+
+configure.ac:
+gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS
+
+Makefile.am:
+
+Include:
+<stdio.h>
+
+License:
+LGPL
+
+Maintainer:
+all
-- 
2.34.1

>From 5d03891d5016f5090338c51272466ba1dfe7db2a Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 21:17:03 +0200
Subject: [PATCH 10/24] vfzprintf-posix: Add tests.

* tests/test-vfzprintf-posix.c: New file, based on
tests/test-vfprintf-posix.c.
* tests/test-vfzprintf-posix.sh: New file, based on
tests/test-vfprintf-posix.sh.
* tests/test-fprintf-posix.h: Update title.
* modules/vfzprintf-posix-tests: New file.
---
 ChangeLog                     |  8 ++++++
 modules/vfzprintf-posix-tests | 16 +++++++++++
 tests/test-fprintf-posix.h    |  2 +-
 tests/test-vfzprintf-posix.c  | 50 +++++++++++++++++++++++++++++++++++
 tests/test-vfzprintf-posix.sh | 16 +++++++++++
 5 files changed, 91 insertions(+), 1 deletion(-)
 create mode 100644 modules/vfzprintf-posix-tests
 create mode 100644 tests/test-vfzprintf-posix.c
 create mode 100755 tests/test-vfzprintf-posix.sh

diff --git a/ChangeLog b/ChangeLog
index 981b2734e7..5cc7ae4ac6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
+	vfzprintf-posix: Add tests.
+	* tests/test-vfzprintf-posix.c: New file, based on
+	tests/test-vfprintf-posix.c.
+	* tests/test-vfzprintf-posix.sh: New file, based on
+	tests/test-vfprintf-posix.sh.
+	* tests/test-fprintf-posix.h: Update title.
+	* modules/vfzprintf-posix-tests: New file.
+
 	vfzprintf-posix: New module.
 	* modules/vfzprintf-posix: New file.
 
diff --git a/modules/vfzprintf-posix-tests b/modules/vfzprintf-posix-tests
new file mode 100644
index 0000000000..99902f90fc
--- /dev/null
+++ b/modules/vfzprintf-posix-tests
@@ -0,0 +1,16 @@
+Files:
+tests/test-vfzprintf-posix.sh
+tests/test-vfzprintf-posix.c
+tests/test-fprintf-posix.h
+tests/test-printf-posix.output
+tests/infinity.h
+tests/macros.h
+
+Depends-on:
+stdint
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-vfzprintf-posix.sh
+check_PROGRAMS += test-vfzprintf-posix
diff --git a/tests/test-fprintf-posix.h b/tests/test-fprintf-posix.h
index eac279ddb8..2242d2af49 100644
--- a/tests/test-fprintf-posix.h
+++ b/tests/test-fprintf-posix.h
@@ -1,4 +1,4 @@
-/* Test of POSIX compatible [v]fprintf() and vd[z]printf() functions.
+/* Test of POSIX compatible [v]f[z]printf() and vd[z]printf() functions.
    Copyright (C) 2007-2024 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/tests/test-vfzprintf-posix.c b/tests/test-vfzprintf-posix.c
new file mode 100644
index 0000000000..219d0b983b
--- /dev/null
+++ b/tests/test-vfzprintf-posix.c
@@ -0,0 +1,50 @@
+/* Test of POSIX compatible vfzprintf() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <br...@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "macros.h"
+
+#define RETTYPE off64_t
+#include "test-fprintf-posix.h"
+
+static off64_t
+my_fzprintf (FILE *fp, const char *format, ...)
+{
+  va_list args;
+  off64_t ret;
+
+  va_start (args, format);
+  ret = vfzprintf (fp, format, args);
+  va_end (args);
+  return ret;
+}
+
+int
+main (int argc, char *argv[])
+{
+  test_function (my_fzprintf);
+  return test_exit_status;
+}
diff --git a/tests/test-vfzprintf-posix.sh b/tests/test-vfzprintf-posix.sh
new file mode 100755
index 0000000000..6d286361e3
--- /dev/null
+++ b/tests/test-vfzprintf-posix.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles="$tmpfiles t-vfzprintf-posix.tmp t-vfzprintf-posix.out"
+${CHECKER} ./test-vfzprintf-posix${EXEEXT} > t-vfzprintf-posix.tmp || exit 1
+LC_ALL=C tr -d '\r' < t-vfzprintf-posix.tmp > t-vfzprintf-posix.out || exit 1
+
+: "${DIFF=diff}"
+${DIFF} "${srcdir}/test-printf-posix.output" t-vfzprintf-posix.out
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
-- 
2.34.1

>From e023d7dbb292db1326db39177ba2b13f36930d25 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 21:18:35 +0200
Subject: [PATCH 11/24] fzprintf-posix: New module.

* modules/fzprintf-posix: New file.
---
 ChangeLog              |  5 +++++
 modules/fzprintf-posix | 22 ++++++++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 modules/fzprintf-posix

diff --git a/ChangeLog b/ChangeLog
index 5cc7ae4ac6..8053aeabdc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-06-30  Bruno Haible  <br...@clisp.org>
+
+	fzprintf-posix: New module.
+	* modules/fzprintf-posix: New file.
+
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
 	vfzprintf-posix: Add tests.
diff --git a/modules/fzprintf-posix b/modules/fzprintf-posix
new file mode 100644
index 0000000000..343da7729b
--- /dev/null
+++ b/modules/fzprintf-posix
@@ -0,0 +1,22 @@
+Description:
+fzprintf() function with POSIX compatible format string interpretation
+
+Files:
+
+Depends-on:
+fzprintf
+mixin/printf-posix
+
+configure.ac:
+gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS
+
+Makefile.am:
+
+Include:
+<stdio.h>
+
+License:
+LGPL
+
+Maintainer:
+all
-- 
2.34.1

>From bfe629490f63607ef950b5f0342d1b9dcb3bf391 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 21:55:13 +0200
Subject: [PATCH 12/24] fzprintf-posix: Add tests.

* tests/test-fzprintf-posix.c: New file, based on
tests/test-fprintf-posix.c.
* tests/test-fzprintf-posix.sh: New file, based on
tests/test-fprintf-posix.sh.
* modules/fzprintf-posix-tests: New file.
---
 ChangeLog                    |  7 +++++++
 modules/fzprintf-posix-tests | 16 ++++++++++++++++
 tests/test-fzprintf-posix.c  | 37 ++++++++++++++++++++++++++++++++++++
 tests/test-fzprintf-posix.sh | 16 ++++++++++++++++
 4 files changed, 76 insertions(+)
 create mode 100644 modules/fzprintf-posix-tests
 create mode 100644 tests/test-fzprintf-posix.c
 create mode 100755 tests/test-fzprintf-posix.sh

diff --git a/ChangeLog b/ChangeLog
index 8053aeabdc..a9a983f90a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
+	fzprintf-posix: Add tests.
+	* tests/test-fzprintf-posix.c: New file, based on
+	tests/test-fprintf-posix.c.
+	* tests/test-fzprintf-posix.sh: New file, based on
+	tests/test-fprintf-posix.sh.
+	* modules/fzprintf-posix-tests: New file.
+
 	fzprintf-posix: New module.
 	* modules/fzprintf-posix: New file.
 
diff --git a/modules/fzprintf-posix-tests b/modules/fzprintf-posix-tests
new file mode 100644
index 0000000000..66ace8a498
--- /dev/null
+++ b/modules/fzprintf-posix-tests
@@ -0,0 +1,16 @@
+Files:
+tests/test-fzprintf-posix.sh
+tests/test-fzprintf-posix.c
+tests/test-fprintf-posix.h
+tests/test-printf-posix.output
+tests/infinity.h
+tests/macros.h
+
+Depends-on:
+stdint
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-fzprintf-posix.sh
+check_PROGRAMS += test-fzprintf-posix
diff --git a/tests/test-fzprintf-posix.c b/tests/test-fzprintf-posix.c
new file mode 100644
index 0000000000..243472b377
--- /dev/null
+++ b/tests/test-fzprintf-posix.c
@@ -0,0 +1,37 @@
+/* Test of POSIX compatible fzprintf() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <br...@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "macros.h"
+
+#define RETTYPE off64_t
+#include "test-fprintf-posix.h"
+
+int
+main (int argc, char *argv[])
+{
+  test_function (fzprintf);
+  return test_exit_status;
+}
diff --git a/tests/test-fzprintf-posix.sh b/tests/test-fzprintf-posix.sh
new file mode 100755
index 0000000000..8ab0e19667
--- /dev/null
+++ b/tests/test-fzprintf-posix.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles="$tmpfiles t-fzprintf-posix.tmp t-fzprintf-posix.out"
+${CHECKER} ./test-fzprintf-posix${EXEEXT} > t-fzprintf-posix.tmp || exit 1
+LC_ALL=C tr -d '\r' < t-fzprintf-posix.tmp > t-fzprintf-posix.out || exit 1
+
+: "${DIFF=diff}"
+${DIFF} "${srcdir}/test-printf-posix.output" t-fzprintf-posix.out
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
-- 
2.34.1

>From 534de9b2afd0365962d097017d802a4d92227579 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 21:57:26 +0200
Subject: [PATCH 13/24] vzprintf-posix: New module.

* modules/vzprintf-posix: New file.
---
 ChangeLog              |  5 +++++
 modules/vzprintf-posix | 22 ++++++++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 modules/vzprintf-posix

diff --git a/ChangeLog b/ChangeLog
index a9a983f90a..4962f24cf2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-06-30  Bruno Haible  <br...@clisp.org>
+
+	vzprintf-posix: New module.
+	* modules/vzprintf-posix: New file.
+
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
 	fzprintf-posix: Add tests.
diff --git a/modules/vzprintf-posix b/modules/vzprintf-posix
new file mode 100644
index 0000000000..0557da9105
--- /dev/null
+++ b/modules/vzprintf-posix
@@ -0,0 +1,22 @@
+Description:
+vzprintf() function with POSIX compatible format string interpretation
+
+Files:
+
+Depends-on:
+vzprintf
+mixin/printf-posix
+
+configure.ac:
+gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS
+
+Makefile.am:
+
+Include:
+<stdio.h>
+
+License:
+LGPL
+
+Maintainer:
+all
-- 
2.34.1

>From 76effdd6989637de1e99ac3d3dbd446f942117b5 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 22:12:41 +0200
Subject: [PATCH 14/24] vzprintf-posix: Add tests.

* tests/test-printf-posix.h (test_function): Use RETTYPE instead of
'int'.
* tests/test-printf-posix.c (RETTYPE): New macro.
* tests/test-vprintf-posix.c (RETTYPE): New macro.
* tests/test-xprintf-posix.c (RETTYPE): New macro.
* tests/test-vzprintf-posix.c: New file, based on
tests/test-vprintf-posix.c.
* tests/test-vzprintf-posix.sh: New file, based on
tests/test-vprintf-posix.sh.
* modules/vzprintf-posix-tests: New file.
---
 ChangeLog                    | 12 +++++++++
 modules/vzprintf-posix-tests | 16 ++++++++++++
 tests/test-printf-posix.c    |  1 +
 tests/test-printf-posix.h    |  4 +--
 tests/test-vprintf-posix.c   |  1 +
 tests/test-vzprintf-posix.c  | 50 ++++++++++++++++++++++++++++++++++++
 tests/test-vzprintf-posix.sh | 16 ++++++++++++
 tests/test-xprintf-posix.c   |  1 +
 8 files changed, 99 insertions(+), 2 deletions(-)
 create mode 100644 modules/vzprintf-posix-tests
 create mode 100644 tests/test-vzprintf-posix.c
 create mode 100755 tests/test-vzprintf-posix.sh

diff --git a/ChangeLog b/ChangeLog
index 4962f24cf2..4d4489279a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
+	vzprintf-posix: Add tests.
+	* tests/test-printf-posix.h (test_function): Use RETTYPE instead of
+	'int'.
+	* tests/test-printf-posix.c (RETTYPE): New macro.
+	* tests/test-vprintf-posix.c (RETTYPE): New macro.
+	* tests/test-xprintf-posix.c (RETTYPE): New macro.
+	* tests/test-vzprintf-posix.c: New file, based on
+	tests/test-vprintf-posix.c.
+	* tests/test-vzprintf-posix.sh: New file, based on
+	tests/test-vprintf-posix.sh.
+	* modules/vzprintf-posix-tests: New file.
+
 	vzprintf-posix: New module.
 	* modules/vzprintf-posix: New file.
 
diff --git a/modules/vzprintf-posix-tests b/modules/vzprintf-posix-tests
new file mode 100644
index 0000000000..c6e4b8eaa9
--- /dev/null
+++ b/modules/vzprintf-posix-tests
@@ -0,0 +1,16 @@
+Files:
+tests/test-vzprintf-posix.sh
+tests/test-vzprintf-posix.c
+tests/test-printf-posix.h
+tests/test-printf-posix.output
+tests/infinity.h
+tests/macros.h
+
+Depends-on:
+stdint
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-vzprintf-posix.sh
+check_PROGRAMS += test-vzprintf-posix
diff --git a/tests/test-printf-posix.c b/tests/test-printf-posix.c
index f24a0297ef..8e7667740e 100644
--- a/tests/test-printf-posix.c
+++ b/tests/test-printf-posix.c
@@ -29,6 +29,7 @@ SIGNATURE_CHECK (printf, int, (char const *, ...));
 
 #include "macros.h"
 
+#define RETTYPE int
 #include "test-printf-posix.h"
 
 int
diff --git a/tests/test-printf-posix.h b/tests/test-printf-posix.h
index 68e8edb175..60b6cf9c84 100644
--- a/tests/test-printf-posix.h
+++ b/tests/test-printf-posix.h
@@ -1,4 +1,4 @@
-/* Test of POSIX compatible vprintf() and printf() functions.
+/* Test of POSIX compatible v[z]printf() and printf() functions.
    Copyright (C) 2007-2024 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -19,7 +19,7 @@
 #include "infinity.h"
 
 static void
-test_function (int (*my_printf) (const char *, ...))
+test_function (RETTYPE (*my_printf) (const char *, ...))
 {
   /* Here we don't test output that may be platform dependent.
      The bulk of the tests is done as part of the 'vasnprintf-posix' module.  */
diff --git a/tests/test-vprintf-posix.c b/tests/test-vprintf-posix.c
index 795b09366b..b25274ab9d 100644
--- a/tests/test-vprintf-posix.c
+++ b/tests/test-vprintf-posix.c
@@ -30,6 +30,7 @@ SIGNATURE_CHECK (vprintf, int, (char const *, va_list));
 
 #include "macros.h"
 
+#define RETTYPE int
 #include "test-printf-posix.h"
 
 static int
diff --git a/tests/test-vzprintf-posix.c b/tests/test-vzprintf-posix.c
new file mode 100644
index 0000000000..daf6e97b0f
--- /dev/null
+++ b/tests/test-vzprintf-posix.c
@@ -0,0 +1,50 @@
+/* Test of POSIX compatible vzprintf() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <br...@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "macros.h"
+
+#define RETTYPE off64_t
+#include "test-printf-posix.h"
+
+static off64_t
+my_zprintf (const char *format, ...)
+{
+  va_list args;
+  off64_t ret;
+
+  va_start (args, format);
+  ret = vzprintf (format, args);
+  va_end (args);
+  return ret;
+}
+
+int
+main (int argc, char *argv[])
+{
+  test_function (my_zprintf);
+  return test_exit_status;
+}
diff --git a/tests/test-vzprintf-posix.sh b/tests/test-vzprintf-posix.sh
new file mode 100755
index 0000000000..fc55247be3
--- /dev/null
+++ b/tests/test-vzprintf-posix.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles="$tmpfiles t-vzprintf-posix.tmp t-vzprintf-posix.out"
+${CHECKER} ./test-vzprintf-posix${EXEEXT} > t-vzprintf-posix.tmp || exit 1
+LC_ALL=C tr -d '\r' < t-vzprintf-posix.tmp > t-vzprintf-posix.out || exit 1
+
+: "${DIFF=diff}"
+${DIFF} "${srcdir}/test-printf-posix.output" t-vzprintf-posix.out
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
diff --git a/tests/test-xprintf-posix.c b/tests/test-xprintf-posix.c
index 29758ef42c..c9e79c0e26 100644
--- a/tests/test-xprintf-posix.c
+++ b/tests/test-xprintf-posix.c
@@ -26,6 +26,7 @@
 
 #include "macros.h"
 
+#define RETTYPE int
 #include "test-printf-posix.h"
 
 int
-- 
2.34.1

>From 43be572f2161491fb8f36392cb4a9be3c2b6a7bb Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 22:17:44 +0200
Subject: [PATCH 15/24] zprintf-posix: New module.

* modules/zprintf-posix: New file.
---
 ChangeLog             |  5 +++++
 modules/zprintf-posix | 22 ++++++++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 modules/zprintf-posix

diff --git a/ChangeLog b/ChangeLog
index 4d4489279a..60c8b29f30 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-06-30  Bruno Haible  <br...@clisp.org>
+
+	zprintf-posix: New module.
+	* modules/zprintf-posix: New file.
+
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
 	vzprintf-posix: Add tests.
diff --git a/modules/zprintf-posix b/modules/zprintf-posix
new file mode 100644
index 0000000000..93c4f49d92
--- /dev/null
+++ b/modules/zprintf-posix
@@ -0,0 +1,22 @@
+Description:
+zprintf() function with POSIX compatible format string interpretation
+
+Files:
+
+Depends-on:
+zprintf
+mixin/printf-posix
+
+configure.ac:
+gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS
+
+Makefile.am:
+
+Include:
+<stdio.h>
+
+License:
+LGPL
+
+Maintainer:
+all
-- 
2.34.1

>From 5c24277e4888e93d8be10cf12e8055bd72895caa Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 22:23:45 +0200
Subject: [PATCH 16/24] zprintf-posix: Add tests.

* tests/test-zprintf-posix.c: New file, based on
tests/test-printf-posix.c.
* tests/test-zprintf-posix.sh: New file, based on
tests/test-printf-posix.sh.
* modules/zprintf-posix-tests: New file.
---
 ChangeLog                   |  7 +++++++
 modules/zprintf-posix-tests | 16 ++++++++++++++++
 tests/test-printf-posix.h   |  2 +-
 tests/test-zprintf-posix.c  | 37 +++++++++++++++++++++++++++++++++++++
 tests/test-zprintf-posix.sh | 16 ++++++++++++++++
 5 files changed, 77 insertions(+), 1 deletion(-)
 create mode 100644 modules/zprintf-posix-tests
 create mode 100644 tests/test-zprintf-posix.c
 create mode 100755 tests/test-zprintf-posix.sh

diff --git a/ChangeLog b/ChangeLog
index 60c8b29f30..db717643c2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
+	zprintf-posix: Add tests.
+	* tests/test-zprintf-posix.c: New file, based on
+	tests/test-printf-posix.c.
+	* tests/test-zprintf-posix.sh: New file, based on
+	tests/test-printf-posix.sh.
+	* modules/zprintf-posix-tests: New file.
+
 	zprintf-posix: New module.
 	* modules/zprintf-posix: New file.
 
diff --git a/modules/zprintf-posix-tests b/modules/zprintf-posix-tests
new file mode 100644
index 0000000000..8c44f35c0f
--- /dev/null
+++ b/modules/zprintf-posix-tests
@@ -0,0 +1,16 @@
+Files:
+tests/test-zprintf-posix.sh
+tests/test-zprintf-posix.c
+tests/test-printf-posix.h
+tests/test-printf-posix.output
+tests/infinity.h
+tests/macros.h
+
+Depends-on:
+stdint
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-zprintf-posix.sh
+check_PROGRAMS += test-zprintf-posix
diff --git a/tests/test-printf-posix.h b/tests/test-printf-posix.h
index 60b6cf9c84..32eed6fab1 100644
--- a/tests/test-printf-posix.h
+++ b/tests/test-printf-posix.h
@@ -1,4 +1,4 @@
-/* Test of POSIX compatible v[z]printf() and printf() functions.
+/* Test of POSIX compatible v[z]printf() and [z]printf() functions.
    Copyright (C) 2007-2024 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/tests/test-zprintf-posix.c b/tests/test-zprintf-posix.c
new file mode 100644
index 0000000000..2eddc7d135
--- /dev/null
+++ b/tests/test-zprintf-posix.c
@@ -0,0 +1,37 @@
+/* Test of POSIX compatible zprintf() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <br...@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "macros.h"
+
+#define RETTYPE off64_t
+#include "test-printf-posix.h"
+
+int
+main (int argc, char *argv[])
+{
+  test_function (zprintf);
+  return test_exit_status;
+}
diff --git a/tests/test-zprintf-posix.sh b/tests/test-zprintf-posix.sh
new file mode 100755
index 0000000000..38169ad4f2
--- /dev/null
+++ b/tests/test-zprintf-posix.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles="$tmpfiles t-zprintf-posix.tmp t-zprintf-posix.out"
+${CHECKER} ./test-zprintf-posix${EXEEXT} > t-zprintf-posix.tmp || exit 1
+LC_ALL=C tr -d '\r' < t-zprintf-posix.tmp > t-zprintf-posix.out || exit 1
+
+: "${DIFF=diff}"
+${DIFF} "${srcdir}/test-printf-posix.output" t-zprintf-posix.out
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
-- 
2.34.1

>From 5f36226c2931db367a435d4c517683d3565c3527 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 22:36:22 +0200
Subject: [PATCH 17/24] vfzprintf-gnu: New module.

* modules/vfzprintf-gnu: New file.
---
 ChangeLog             |  5 +++++
 modules/vfzprintf-gnu | 23 +++++++++++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 modules/vfzprintf-gnu

diff --git a/ChangeLog b/ChangeLog
index db717643c2..4e374a5913 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-06-30  Bruno Haible  <br...@clisp.org>
+
+	vfzprintf-gnu: New module.
+	* modules/vfzprintf-gnu: New file.
+
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
 	zprintf-posix: Add tests.
diff --git a/modules/vfzprintf-gnu b/modules/vfzprintf-gnu
new file mode 100644
index 0000000000..ffb673edf9
--- /dev/null
+++ b/modules/vfzprintf-gnu
@@ -0,0 +1,23 @@
+Description:
+vfzprintf() function
+with POSIX and GNU compatible format string interpretation
+
+Files:
+
+Depends-on:
+vfzprintf-posix
+mixin/printf-gnu
+
+configure.ac:
+gl_PREREQ_VASNPRINTF_WITH_GNU_EXTRAS
+
+Makefile.am:
+
+Include:
+<stdio.h>
+
+License:
+LGPL
+
+Maintainer:
+all
-- 
2.34.1

>From 88f544ba9f2d7ecf534d2265c6dc8f7c57119b7d Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 22:42:20 +0200
Subject: [PATCH 18/24] vfzprintf-gnu: Add tests.

* tests/test-vfzprintf-gnu.c: New file, based on
tests/test-vfprintf-gnu.c.
* tests/test-vfzprintf-gnu.sh: New file, based on
tests/test-vfprintf-gnu.sh.
* tests/test-fprintf-gnu.h: Update title.
* modules/vfzprintf-gnu-tests: New file.
---
 ChangeLog                   |  8 ++++++
 modules/vfzprintf-gnu-tests | 14 +++++++++++
 tests/test-fprintf-gnu.h    |  2 +-
 tests/test-vfzprintf-gnu.c  | 49 +++++++++++++++++++++++++++++++++++++
 tests/test-vfzprintf-gnu.sh | 16 ++++++++++++
 5 files changed, 88 insertions(+), 1 deletion(-)
 create mode 100644 modules/vfzprintf-gnu-tests
 create mode 100644 tests/test-vfzprintf-gnu.c
 create mode 100755 tests/test-vfzprintf-gnu.sh

diff --git a/ChangeLog b/ChangeLog
index 4e374a5913..345716dcb9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
+	vfzprintf-gnu: Add tests.
+	* tests/test-vfzprintf-gnu.c: New file, based on
+	tests/test-vfprintf-gnu.c.
+	* tests/test-vfzprintf-gnu.sh: New file, based on
+	tests/test-vfprintf-gnu.sh.
+	* tests/test-fprintf-gnu.h: Update title.
+	* modules/vfzprintf-gnu-tests: New file.
+
 	vfzprintf-gnu: New module.
 	* modules/vfzprintf-gnu: New file.
 
diff --git a/modules/vfzprintf-gnu-tests b/modules/vfzprintf-gnu-tests
new file mode 100644
index 0000000000..64d217bb38
--- /dev/null
+++ b/modules/vfzprintf-gnu-tests
@@ -0,0 +1,14 @@
+Files:
+tests/test-vfzprintf-gnu.sh
+tests/test-vfzprintf-gnu.c
+tests/test-fprintf-gnu.h
+tests/test-printf-gnu.output
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-vfzprintf-gnu.sh
+check_PROGRAMS += test-vfzprintf-gnu
diff --git a/tests/test-fprintf-gnu.h b/tests/test-fprintf-gnu.h
index ce6dc39557..6c8c3b9f01 100644
--- a/tests/test-fprintf-gnu.h
+++ b/tests/test-fprintf-gnu.h
@@ -1,4 +1,4 @@
-/* Test of POSIX and GNU compatible [v]fprintf() and vd[z]printf() functions.
+/* Test of POSIX and GNU compatible [v]f[z]printf() and vd[z]printf() functions.
    Copyright (C) 2007-2024 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/tests/test-vfzprintf-gnu.c b/tests/test-vfzprintf-gnu.c
new file mode 100644
index 0000000000..b2ede1f584
--- /dev/null
+++ b/tests/test-vfzprintf-gnu.c
@@ -0,0 +1,49 @@
+/* Test of POSIX and GNU compatible vfzprintf() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <br...@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <string.h>
+
+#include "macros.h"
+
+#define RETTYPE off64_t
+#include "test-fprintf-gnu.h"
+
+static off64_t
+my_fzprintf (FILE *fp, const char *format, ...)
+{
+  va_list args;
+  off64_t ret;
+
+  va_start (args, format);
+  ret = vfzprintf (fp, format, args);
+  va_end (args);
+  return ret;
+}
+
+int
+main (int argc, char *argv[])
+{
+  test_function (my_fzprintf);
+  return test_exit_status;
+}
diff --git a/tests/test-vfzprintf-gnu.sh b/tests/test-vfzprintf-gnu.sh
new file mode 100755
index 0000000000..5c60192b98
--- /dev/null
+++ b/tests/test-vfzprintf-gnu.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles="$tmpfiles t-vfzprintf-gnu.tmp t-vfzprintf-gnu.out"
+${CHECKER} ./test-vfzprintf-gnu${EXEEXT} > t-vfzprintf-gnu.tmp || exit 1
+LC_ALL=C tr -d '\r' < t-vfzprintf-gnu.tmp > t-vfzprintf-gnu.out || exit 1
+
+: "${DIFF=diff}"
+${DIFF} "${srcdir}/test-printf-gnu.output" t-vfzprintf-gnu.out
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
-- 
2.34.1

>From 929194926d81d927b255bdc5160835ab175df2be Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 22:49:52 +0200
Subject: [PATCH 19/24] fzprintf-gnu: New module.

* modules/fzprintf-gnu: New file.
---
 ChangeLog            |  5 +++++
 modules/fzprintf-gnu | 23 +++++++++++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 modules/fzprintf-gnu

diff --git a/ChangeLog b/ChangeLog
index 345716dcb9..e2efc8327a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-06-30  Bruno Haible  <br...@clisp.org>
+
+	fzprintf-gnu: New module.
+	* modules/fzprintf-gnu: New file.
+
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
 	vfzprintf-gnu: Add tests.
diff --git a/modules/fzprintf-gnu b/modules/fzprintf-gnu
new file mode 100644
index 0000000000..59acf4c05a
--- /dev/null
+++ b/modules/fzprintf-gnu
@@ -0,0 +1,23 @@
+Description:
+fzprintf() function
+with POSIX and GNU compatible format string interpretation
+
+Files:
+
+Depends-on:
+fzprintf-posix
+mixin/printf-gnu
+
+configure.ac:
+gl_PREREQ_VASNPRINTF_WITH_GNU_EXTRAS
+
+Makefile.am:
+
+Include:
+<stdio.h>
+
+License:
+LGPL
+
+Maintainer:
+all
-- 
2.34.1

>From 606d7377b1b7e2bf1364770a4f9f1a685c6e7269 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 22:56:15 +0200
Subject: [PATCH 20/24] fzprintf-gnu: Add tests.

* tests/test-fzprintf-gnu.c: New file, based on
tests/test-fprintf-gnu.c.
* tests/test-fzprintf-gnu.sh: New file, based on
tests/test-fprintf-gnu.sh.
* modules/fzprintf-gnu-tests: New file.
---
 ChangeLog                  |  7 +++++++
 modules/fzprintf-gnu-tests | 14 ++++++++++++++
 tests/test-fzprintf-gnu.c  | 37 +++++++++++++++++++++++++++++++++++++
 tests/test-fzprintf-gnu.sh | 16 ++++++++++++++++
 4 files changed, 74 insertions(+)
 create mode 100644 modules/fzprintf-gnu-tests
 create mode 100644 tests/test-fzprintf-gnu.c
 create mode 100755 tests/test-fzprintf-gnu.sh

diff --git a/ChangeLog b/ChangeLog
index e2efc8327a..0d1337af30 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
+	fzprintf-gnu: Add tests.
+	* tests/test-fzprintf-gnu.c: New file, based on
+	tests/test-fprintf-gnu.c.
+	* tests/test-fzprintf-gnu.sh: New file, based on
+	tests/test-fprintf-gnu.sh.
+	* modules/fzprintf-gnu-tests: New file.
+
 	fzprintf-gnu: New module.
 	* modules/fzprintf-gnu: New file.
 
diff --git a/modules/fzprintf-gnu-tests b/modules/fzprintf-gnu-tests
new file mode 100644
index 0000000000..8ab6bdcb8d
--- /dev/null
+++ b/modules/fzprintf-gnu-tests
@@ -0,0 +1,14 @@
+Files:
+tests/test-fzprintf-gnu.sh
+tests/test-fzprintf-gnu.c
+tests/test-fprintf-gnu.h
+tests/test-printf-gnu.output
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-fzprintf-gnu.sh
+check_PROGRAMS += test-fzprintf-gnu
diff --git a/tests/test-fzprintf-gnu.c b/tests/test-fzprintf-gnu.c
new file mode 100644
index 0000000000..5acd8dd78e
--- /dev/null
+++ b/tests/test-fzprintf-gnu.c
@@ -0,0 +1,37 @@
+/* Test of POSIX and GNU compatible fzprintf() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <br...@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <string.h>
+
+#include "macros.h"
+
+#define RETTYPE off64_t
+#include "test-fprintf-gnu.h"
+
+int
+main (int argc, char *argv[])
+{
+  test_function (fzprintf);
+  return test_exit_status;
+}
diff --git a/tests/test-fzprintf-gnu.sh b/tests/test-fzprintf-gnu.sh
new file mode 100755
index 0000000000..668ecdc29a
--- /dev/null
+++ b/tests/test-fzprintf-gnu.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles="$tmpfiles t-fzprintf-gnu.tmp t-fzprintf-gnu.out"
+${CHECKER} ./test-fzprintf-gnu${EXEEXT} > t-fzprintf-gnu.tmp || exit 1
+LC_ALL=C tr -d '\r' < t-fzprintf-gnu.tmp > t-fzprintf-gnu.out || exit 1
+
+: "${DIFF=diff}"
+${DIFF} "${srcdir}/test-printf-gnu.output" t-fzprintf-gnu.out
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
-- 
2.34.1

>From cb5dabfd8a2c6ee996877bc02b3ef96e2cbe52dc Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 22:57:50 +0200
Subject: [PATCH 21/24] vzprintf-gnu: New module.

* modules/vzprintf-gnu: New file.
---
 ChangeLog            |  5 +++++
 modules/vzprintf-gnu | 23 +++++++++++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 modules/vzprintf-gnu

diff --git a/ChangeLog b/ChangeLog
index 0d1337af30..0a450fe9db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-06-30  Bruno Haible  <br...@clisp.org>
+
+	vzprintf-gnu: New module.
+	* modules/vzprintf-gnu: New file.
+
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
 	fzprintf-gnu: Add tests.
diff --git a/modules/vzprintf-gnu b/modules/vzprintf-gnu
new file mode 100644
index 0000000000..22c94cdbdf
--- /dev/null
+++ b/modules/vzprintf-gnu
@@ -0,0 +1,23 @@
+Description:
+vzprintf() function
+with POSIX and GNU compatible format string interpretation
+
+Files:
+
+Depends-on:
+vzprintf-posix
+mixin/printf-gnu
+
+configure.ac:
+gl_PREREQ_VASNPRINTF_WITH_GNU_EXTRAS
+
+Makefile.am:
+
+Include:
+<stdio.h>
+
+License:
+LGPL
+
+Maintainer:
+all
-- 
2.34.1

>From c630fd2fce49231adca9a58eccce0ec71be782d1 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 23:04:37 +0200
Subject: [PATCH 22/24] vzprintf-gnu: Add tests.

* tests/test-printf-gnu.h (test_function): Use RETTYPE instead of 'int'.
* tests/test-printf-gnu.c (RETTYPE): New macro.
* tests/test-vprintf-gnu.c (RETTYPE): New macro.
* tests/test-vzprintf-gnu.c: New file, based on
tests/test-vprintf-gnu.c.
* tests/test-vzprintf-gnu.sh: New file, based on
tests/test-vprintf-gnu.sh.
* modules/vzprintf-gnu-tests: New file.
---
 ChangeLog                  | 10 ++++++++
 modules/vzprintf-gnu-tests | 14 +++++++++++
 tests/test-printf-gnu.c    |  1 +
 tests/test-printf-gnu.h    |  4 ++--
 tests/test-vprintf-gnu.c   |  3 ++-
 tests/test-vzprintf-gnu.c  | 49 ++++++++++++++++++++++++++++++++++++++
 tests/test-vzprintf-gnu.sh | 16 +++++++++++++
 7 files changed, 94 insertions(+), 3 deletions(-)
 create mode 100644 modules/vzprintf-gnu-tests
 create mode 100644 tests/test-vzprintf-gnu.c
 create mode 100755 tests/test-vzprintf-gnu.sh

diff --git a/ChangeLog b/ChangeLog
index 0a450fe9db..d6c8927bcb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
+	vzprintf-gnu: Add tests.
+	* tests/test-printf-gnu.h (test_function): Use RETTYPE instead of 'int'.
+	* tests/test-printf-gnu.c (RETTYPE): New macro.
+	* tests/test-vprintf-gnu.c (RETTYPE): New macro.
+	* tests/test-vzprintf-gnu.c: New file, based on
+	tests/test-vprintf-gnu.c.
+	* tests/test-vzprintf-gnu.sh: New file, based on
+	tests/test-vprintf-gnu.sh.
+	* modules/vzprintf-gnu-tests: New file.
+
 	vzprintf-gnu: New module.
 	* modules/vzprintf-gnu: New file.
 
diff --git a/modules/vzprintf-gnu-tests b/modules/vzprintf-gnu-tests
new file mode 100644
index 0000000000..d08e58f813
--- /dev/null
+++ b/modules/vzprintf-gnu-tests
@@ -0,0 +1,14 @@
+Files:
+tests/test-vzprintf-gnu.sh
+tests/test-vzprintf-gnu.c
+tests/test-printf-gnu.h
+tests/test-printf-gnu.output
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-vzprintf-gnu.sh
+check_PROGRAMS += test-vzprintf-gnu
diff --git a/tests/test-printf-gnu.c b/tests/test-printf-gnu.c
index ccd4f8bd67..f229f5fd59 100644
--- a/tests/test-printf-gnu.c
+++ b/tests/test-printf-gnu.c
@@ -25,6 +25,7 @@
 
 #include "macros.h"
 
+#define RETTYPE int
 #include "test-printf-gnu.h"
 
 int
diff --git a/tests/test-printf-gnu.h b/tests/test-printf-gnu.h
index 1ee541669a..b9a9effe04 100644
--- a/tests/test-printf-gnu.h
+++ b/tests/test-printf-gnu.h
@@ -1,4 +1,4 @@
-/* Test of POSIX and GNU compatible vprintf() and printf() functions.
+/* Test of POSIX and GNU compatible [v][z]printf() functions.
    Copyright (C) 2007-2024 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -17,7 +17,7 @@
 /* Written by Bruno Haible <br...@clisp.org>, 2023.  */
 
 static void
-test_function (int (*my_printf) (const char *, ...))
+test_function (RETTYPE (*my_printf) (const char *, ...))
 {
   /* Here we don't test output that may be platform dependent.
      The bulk of the tests is done as part of the 'vasnprintf-posix' module.  */
diff --git a/tests/test-vprintf-gnu.c b/tests/test-vprintf-gnu.c
index 1655d26140..638ac70a6f 100644
--- a/tests/test-vprintf-gnu.c
+++ b/tests/test-vprintf-gnu.c
@@ -1,4 +1,4 @@
-/* Test of POSIX and GNU compatible vfprintf() function.
+/* Test of POSIX and GNU compatible vprintf() function.
    Copyright (C) 2007-2024 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -26,6 +26,7 @@
 
 #include "macros.h"
 
+#define RETTYPE int
 #include "test-printf-gnu.h"
 
 static int
diff --git a/tests/test-vzprintf-gnu.c b/tests/test-vzprintf-gnu.c
new file mode 100644
index 0000000000..1056f0e45b
--- /dev/null
+++ b/tests/test-vzprintf-gnu.c
@@ -0,0 +1,49 @@
+/* Test of POSIX and GNU compatible vzprintf() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <br...@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <string.h>
+
+#include "macros.h"
+
+#define RETTYPE off64_t
+#include "test-printf-gnu.h"
+
+static off64_t
+my_zprintf (const char *format, ...)
+{
+  va_list args;
+  off64_t ret;
+
+  va_start (args, format);
+  ret = vzprintf (format, args);
+  va_end (args);
+  return ret;
+}
+
+int
+main (int argc, char *argv[])
+{
+  test_function (my_zprintf);
+  return test_exit_status;
+}
diff --git a/tests/test-vzprintf-gnu.sh b/tests/test-vzprintf-gnu.sh
new file mode 100755
index 0000000000..471a4af02f
--- /dev/null
+++ b/tests/test-vzprintf-gnu.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles="$tmpfiles t-vzprintf-gnu.tmp t-vzprintf-gnu.out"
+${CHECKER} ./test-vzprintf-gnu${EXEEXT} > t-vzprintf-gnu.tmp || exit 1
+LC_ALL=C tr -d '\r' < t-vzprintf-gnu.tmp > t-vzprintf-gnu.out || exit 1
+
+: "${DIFF=diff}"
+${DIFF} "${srcdir}/test-printf-gnu.output" t-vzprintf-gnu.out
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
-- 
2.34.1

>From 20b4e573b26acb2c4076ab92880ba9ad07324f92 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 23:06:12 +0200
Subject: [PATCH 23/24] zprintf-gnu: New module.

* modules/zprintf-gnu: New file.
---
 ChangeLog           |  5 +++++
 modules/zprintf-gnu | 23 +++++++++++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 modules/zprintf-gnu

diff --git a/ChangeLog b/ChangeLog
index d6c8927bcb..2ade395fa4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-06-30  Bruno Haible  <br...@clisp.org>
+
+	zprintf-gnu: New module.
+	* modules/zprintf-gnu: New file.
+
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
 	vzprintf-gnu: Add tests.
diff --git a/modules/zprintf-gnu b/modules/zprintf-gnu
new file mode 100644
index 0000000000..479cf5e157
--- /dev/null
+++ b/modules/zprintf-gnu
@@ -0,0 +1,23 @@
+Description:
+zprintf() function
+with POSIX and GNU compatible format string interpretation
+
+Files:
+
+Depends-on:
+zprintf-posix
+mixin/printf-gnu
+
+configure.ac:
+gl_PREREQ_VASNPRINTF_WITH_GNU_EXTRAS
+
+Makefile.am:
+
+Include:
+<stdio.h>
+
+License:
+LGPL
+
+Maintainer:
+all
-- 
2.34.1

>From 7ef85f40fd55d9d22f797fa8d14b10855b29766f Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 30 Jun 2024 23:10:41 +0200
Subject: [PATCH 24/24] zprintf-gnu: Add tests.

* tests/test-zprintf-gnu.c: New file, based on tests/test-printf-gnu.c.
* tests/test-zprintf-gnu.sh: New file, based on
tests/test-printf-gnu.sh.
* modules/zprintf-gnu-tests: New file.
---
 ChangeLog                 |  6 ++++++
 modules/zprintf-gnu-tests | 14 ++++++++++++++
 tests/test-zprintf-gnu.c  | 36 ++++++++++++++++++++++++++++++++++++
 tests/test-zprintf-gnu.sh | 16 ++++++++++++++++
 4 files changed, 72 insertions(+)
 create mode 100644 modules/zprintf-gnu-tests
 create mode 100644 tests/test-zprintf-gnu.c
 create mode 100755 tests/test-zprintf-gnu.sh

diff --git a/ChangeLog b/ChangeLog
index 2ade395fa4..6a1e5d92a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2024-06-30  Bruno Haible  <br...@clisp.org>
 
+	zprintf-gnu: Add tests.
+	* tests/test-zprintf-gnu.c: New file, based on tests/test-printf-gnu.c.
+	* tests/test-zprintf-gnu.sh: New file, based on
+	tests/test-printf-gnu.sh.
+	* modules/zprintf-gnu-tests: New file.
+
 	zprintf-gnu: New module.
 	* modules/zprintf-gnu: New file.
 
diff --git a/modules/zprintf-gnu-tests b/modules/zprintf-gnu-tests
new file mode 100644
index 0000000000..72edbfe514
--- /dev/null
+++ b/modules/zprintf-gnu-tests
@@ -0,0 +1,14 @@
+Files:
+tests/test-zprintf-gnu.sh
+tests/test-zprintf-gnu.c
+tests/test-printf-gnu.h
+tests/test-printf-gnu.output
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-zprintf-gnu.sh
+check_PROGRAMS += test-zprintf-gnu
diff --git a/tests/test-zprintf-gnu.c b/tests/test-zprintf-gnu.c
new file mode 100644
index 0000000000..4bdd5028c7
--- /dev/null
+++ b/tests/test-zprintf-gnu.c
@@ -0,0 +1,36 @@
+/* Test of POSIX and GNU compatible zprintf() function.
+   Copyright (C) 2007-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <br...@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <stddef.h>
+#include <string.h>
+
+#include "macros.h"
+
+#define RETTYPE off64_t
+#include "test-printf-gnu.h"
+
+int
+main (int argc, char *argv[])
+{
+  test_function (zprintf);
+  return test_exit_status;
+}
diff --git a/tests/test-zprintf-gnu.sh b/tests/test-zprintf-gnu.sh
new file mode 100755
index 0000000000..c5902178a5
--- /dev/null
+++ b/tests/test-zprintf-gnu.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles="$tmpfiles t-zprintf-gnu.tmp t-zprintf-gnu.out"
+${CHECKER} ./test-zprintf-gnu${EXEEXT} > t-zprintf-gnu.tmp || exit 1
+LC_ALL=C tr -d '\r' < t-zprintf-gnu.tmp > t-zprintf-gnu.out || exit 1
+
+: "${DIFF=diff}"
+${DIFF} "${srcdir}/test-printf-gnu.output" t-zprintf-gnu.out
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
-- 
2.34.1

Reply via email to