* lib/printf-parse.c (PRINTF_PARSE): Recognize the 'b' directive.
* lib/printf-parse.h: Update comment.
* lib/wprintf-parse.h: Likewise.
* lib/vasnprintf.c (MAX_ROOM_NEEDED, VASNPRINTF): Add support for the
'b' directive.
* m4/printf.m4 (gl_PRINTF_DIRECTIVE_B): New macro.
* m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_DIRECTIVE_B): New macro.
(gl_PREREQ_VASNPRINTF_WITH_EXTRAS): Invoke it.
* m4/vasnwprintf-posix.m4 (gl_FUNC_VASNWPRINTF_POSIX): Invoke
gl_PREREQ_VASNPRINTF_DIRECTIVE_B.
* m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_POSIX): Require
gl_PRINTF_DIRECTIVE_B and test its result. Invoke
gl_PREREQ_VASNPRINTF_DIRECTIVE_B.
* 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 some tests of the %b
directive.
* tests/test-sprintf-posix.h (test_function): Likewise.
* tests/test-vasnprintf-posix.c (test_function): Likewise.
* tests/test-vasnwprintf-posix.c (test_function): Likewise.
* tests/test-vasprintf-posix.c (test_function): Likewise.
* doc/glibc-functions/asprintf.texi: Mention the 'b' directive.
* 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/fwprintf.texi: Likewise.
* doc/posix-functions/printf.texi: Likewise.
* doc/posix-functions/snprintf.texi: Likewise.
* doc/posix-functions/sprintf.texi: Likewise.
* doc/posix-functions/swprintf.texi: Likewise.
* doc/posix-functions/vdprintf.texi: Likewise.
* doc/posix-functions/vfprintf.texi: Likewise.
* doc/posix-functions/vfwprintf.texi: Likewise.
* doc/posix-functions/vprintf.texi: Likewise.
* doc/posix-functions/vsnprintf.texi: Likewise.
* doc/posix-functions/vsprintf.texi: Likewise.
* doc/posix-functions/vswprintf.texi: Likewise.
* doc/posix-functions/vwprintf.texi: Likewise.
* doc/posix-functions/wprintf.texi: Likewise.
+2023-03-17 Bruno Haible <bruno@clisp.org>
+
+ *printf-posix: ISO C 23: Add %b directive for binary output of integers.
+ * lib/printf-parse.c (PRINTF_PARSE): Recognize the 'b' directive.
+ * lib/printf-parse.h: Update comment.
+ * lib/wprintf-parse.h: Likewise.
+ * lib/vasnprintf.c (MAX_ROOM_NEEDED, VASNPRINTF): Add support for the
+ 'b' directive.
+ * m4/printf.m4 (gl_PRINTF_DIRECTIVE_B): New macro.
+ * m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_DIRECTIVE_B): New macro.
+ (gl_PREREQ_VASNPRINTF_WITH_EXTRAS): Invoke it.
+ * m4/vasnwprintf-posix.m4 (gl_FUNC_VASNWPRINTF_POSIX): Invoke
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_B.
+ * m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_POSIX): Require
+ gl_PRINTF_DIRECTIVE_B and test its result. Invoke
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_B.
+ * 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 some tests of the %b
+ directive.
+ * tests/test-sprintf-posix.h (test_function): Likewise.
+ * tests/test-vasnprintf-posix.c (test_function): Likewise.
+ * tests/test-vasnwprintf-posix.c (test_function): Likewise.
+ * tests/test-vasprintf-posix.c (test_function): Likewise.
+ * doc/glibc-functions/asprintf.texi: Mention the 'b' directive.
+ * 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/fwprintf.texi: Likewise.
+ * doc/posix-functions/printf.texi: Likewise.
+ * doc/posix-functions/snprintf.texi: Likewise.
+ * doc/posix-functions/sprintf.texi: Likewise.
+ * doc/posix-functions/swprintf.texi: Likewise.
+ * doc/posix-functions/vdprintf.texi: Likewise.
+ * doc/posix-functions/vfprintf.texi: Likewise.
+ * doc/posix-functions/vfwprintf.texi: Likewise.
+ * doc/posix-functions/vprintf.texi: Likewise.
+ * doc/posix-functions/vsnprintf.texi: Likewise.
+ * doc/posix-functions/vsprintf.texi: Likewise.
+ * doc/posix-functions/vswprintf.texi: Likewise.
+ * doc/posix-functions/vwprintf.texi: Likewise.
+ * doc/posix-functions/wprintf.texi: Likewise.
+
2023-03-17 Bruno Haible <bruno@clisp.org>
vasnprintf, vasnwprintf: Simplify code.
platforms:
glibc-2.3.6, Mac OS X 10.5, NetBSD 9.0, OpenBSD 4.0, Solaris 11.4, Cygwin 1.5.x.
@item
+This function does not support the @samp{b} directive, required by ISO C23,
+on some platforms:
+glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+AIX 7.2, Solaris 11.4, Cygwin 2.9.0.
+@item
This function does not support the @samp{F} directive on some platforms:
NetBSD 3.0, Cygwin 1.5.x.
@item
glibc-2.3.6, NetBSD 9.0, OpenBSD 4.0, AIX 5.2, HP-UX 11,
IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14.
@item
+This function does not support the @samp{b} directive, required by ISO C23,
+on some platforms:
+glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+AIX 7.2, HP-UX 11, IRIX 6.5, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
+@item
This function does not support the @samp{F} directive on some platforms:
NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
Cygwin 1.5.x, mingw, MSVC 14.
glibc-2.3.6, NetBSD 9.0, OpenBSD 4.0, AIX 5.2, HP-UX 11,
IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14.
@item
+This function does not support the @samp{b} directive, required by ISO C23,
+on some platforms:
+glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+AIX 7.2, HP-UX 11, IRIX 6.5, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
+@item
This function does not support the @samp{F} directive on some platforms:
NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
Cygwin 1.5.x, mingw, MSVC 14.
platforms:
glibc-2.3.6, Mac OS X 10.5, NetBSD 9.0, OpenBSD 4.0, Solaris 11.4, Cygwin 1.5.x.
@item
+This function does not support the @samp{b} directive, required by ISO C23,
+on some platforms:
+glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+AIX 7.2, Solaris 11.4, Cygwin 2.9.0.
+@item
This function does not support the @samp{F} directive on some platforms:
NetBSD 3.0, Cygwin 1.5.x.
@item
platforms:
glibc-2.3.6, Solaris 11.4.
@item
+This function does not support the @samp{b} directive, required by ISO C23,
+on some platforms:
+glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+AIX 7.2, Solaris 11.4, Cygwin 2.9.0.
+@item
This function does not support the @samp{n} directive on some platforms:
glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
macOS 11.1.
glibc-2.3.6, Mac OS X 10.5, NetBSD 9.0, OpenBSD 4.0, AIX 5.2, HP-UX 11,
IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14.
@item
+This function does not support the @samp{b} directive, required by ISO C23,
+on some platforms:
+glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+AIX 7.2, HP-UX 11, IRIX 6.5, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
+@item
This function does not support the @samp{F} directive on some platforms:
NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
Cygwin 1.5.x, mingw, MSVC 14.
Portability problems not fixed by Gnulib:
@itemize
@item
-The @code{%m} directive is not portable, use @code{%s} mapped to an
-argument of @code{strerror(errno)} (or a version of @code{strerror_r})
-instead.
-@item
This function is missing on some platforms:
NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, HP-UX 11.00, IRIX 6.5, Cygwin 1.5.x.
@item
On Windows and 32-bit AIX platforms, @code{wchar_t} is a 16-bit type and therefore cannot
accommodate all Unicode characters.
@item
+This function does not support the @samp{b} directive, required by ISO C23,
+on some platforms:
+glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+AIX 7.2, HP-UX 11, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
+@item
+The @code{%m} directive is not portable, use @code{%s} mapped to an
+argument of @code{strerror(errno)} (or a version of @code{strerror_r})
+instead.
+@item
When formatting an integer with grouping flag, this function inserts thousands
separators even in the "C" locale on some platforms:
NetBSD 5.1.
glibc-2.3.6, Mac OS X 10.5, NetBSD 9.0, OpenBSD 4.0, AIX 5.2, HP-UX 11,
IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14.
@item
+This function does not support the @samp{b} directive, required by ISO C23,
+on some platforms:
+glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+AIX 7.2, HP-UX 11, IRIX 6.5, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
+@item
This function does not support the @samp{F} directive on some platforms:
NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
Cygwin 1.5.x, mingw, MSVC 14.
glibc-2.3.6, Mac OS X 10.5, NetBSD 9.0, OpenBSD 4.0, AIX 5.2, HP-UX 11,
IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14.
@item
+This function does not support the @samp{b} directive, required by ISO C23,
+on some platforms:
+glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+AIX 7.2, HP-UX 11, IRIX 6.5, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
+@item
This function does not support the @samp{F} directive on some platforms:
NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
Cygwin 1.5.x, mingw, MSVC 14.
glibc-2.3.6, Mac OS X 10.5, NetBSD 9.0, OpenBSD 4.0, AIX 5.2, HP-UX 11,
IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14.
@item
+This function does not support the @samp{b} directive, required by ISO C23,
+on some platforms:
+glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+AIX 7.2, HP-UX 11, IRIX 6.5, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
+@item
This function does not support the @samp{F} directive on some platforms:
NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
Cygwin 1.5.x, mingw, MSVC 14.
Portability problems not fixed by Gnulib:
@itemize
@item
-The @code{%m} directive is not portable, use @code{%s} mapped to an
-argument of @code{strerror(errno)} (or a version of @code{strerror_r})
-instead.
-@item
This function is missing on some platforms:
NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, HP-UX 11.00, IRIX 6.5, Cygwin 1.5.x.
@item
@item
On Windows, this function does not take a buffer size as second argument.
@item
+This function does not support the @samp{b} directive, required by ISO C23,
+on some platforms:
+glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+AIX 7.2, HP-UX 11, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
+@item
+The @code{%m} directive is not portable, use @code{%s} mapped to an
+argument of @code{strerror(errno)} (or a version of @code{strerror_r})
+instead.
+@item
When formatting an integer with grouping flag, this function inserts thousands
separators even in the "C" locale on some platforms:
NetBSD 5.1.
platforms:
glibc-2.3.6, Solaris 11.4.
@item
+This function does not support the @samp{b} directive, required by ISO C23,
+on some platforms:
+glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+AIX 7.2, Solaris 11.4, Cygwin 2.9.0.
+@item
This function does not support the @samp{n} directive on some platforms:
glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
macOS 11.1.
glibc-2.3.6, Mac OS X 10.5, NetBSD 9.0, OpenBSD 4.0, AIX 5.2, HP-UX 11,
IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14.
@item
+This function does not support the @samp{b} directive, required by ISO C23,
+on some platforms:
+glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+AIX 7.2, HP-UX 11, IRIX 6.5, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
+@item
This function does not support the @samp{F} directive on some platforms:
NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
Cygwin 1.5.x, mingw, MSVC 14.
Portability problems not fixed by Gnulib:
@itemize
@item
-The @code{%m} directive is not portable, use @code{%s} mapped to an
-argument of @code{strerror(errno)} (or a version of @code{strerror_r})
-instead.
-@item
This function is missing on some platforms:
NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, HP-UX 11.00, IRIX 6.5, Cygwin 1.5.x.
@item
On Windows and 32-bit AIX platforms, @code{wchar_t} is a 16-bit type and therefore cannot
accommodate all Unicode characters.
@item
+This function does not support the @samp{b} directive, required by ISO C23,
+on some platforms:
+glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+AIX 7.2, HP-UX 11, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
+@item
+The @code{%m} directive is not portable, use @code{%s} mapped to an
+argument of @code{strerror(errno)} (or a version of @code{strerror_r})
+instead.
+@item
When formatting an integer with grouping flag, this function inserts thousands
separators even in the "C" locale on some platforms:
NetBSD 5.1.
glibc-2.3.6, Mac OS X 10.5, NetBSD 9.0, OpenBSD 4.0, AIX 5.2, HP-UX 11,
IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14.
@item
+This function does not support the @samp{b} directive, required by ISO C23,
+on some platforms:
+glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+AIX 7.2, HP-UX 11, IRIX 6.5, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
+@item
This function does not support the @samp{F} directive on some platforms:
NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
Cygwin 1.5.x, mingw, MSVC 14.
glibc-2.3.6, Mac OS X 10.5, NetBSD 9.0, OpenBSD 4.0, AIX 5.2, HP-UX 11,
IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14.
@item
+This function does not support the @samp{b} directive, required by ISO C23,
+on some platforms:
+glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+AIX 7.2, HP-UX 11, IRIX 6.5, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
+@item
This function does not support the @samp{F} directive on some platforms:
NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
Cygwin 1.5.x, mingw, MSVC 14.
glibc-2.3.6, Mac OS X 10.5, NetBSD 9.0, OpenBSD 4.0, AIX 5.2, HP-UX 11,
IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14.
@item
+This function does not support the @samp{b} directive, required by ISO C23,
+on some platforms:
+glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+AIX 7.2, HP-UX 11, IRIX 6.5, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
+@item
This function does not support the @samp{F} directive on some platforms:
NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
Cygwin 1.5.x, mingw, MSVC 14.
Portability problems not fixed by Gnulib:
@itemize
@item
-The @code{%m} directive is not portable, use @code{%s} mapped to an
-argument of @code{strerror(errno)} (or a version of @code{strerror_r})
-instead.
-@item
This function is missing on some platforms:
NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, HP-UX 11.00, IRIX 6.5, Cygwin 1.5.x.
@item
@item
On Windows, this function does not take a buffer size as second argument.
@item
+This function does not support the @samp{b} directive, required by ISO C23,
+on some platforms:
+glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+AIX 7.2, HP-UX 11, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
+@item
+The @code{%m} directive is not portable, use @code{%s} mapped to an
+argument of @code{strerror(errno)} (or a version of @code{strerror_r})
+instead.
+@item
When formatting an integer with grouping flag, this function inserts thousands
separators even in the "C" locale on some platforms:
NetBSD 5.1.
Portability problems not fixed by Gnulib:
@itemize
@item
-The @code{%m} directive is not portable, use @code{%s} mapped to an
-argument of @code{strerror(errno)} (or a version of @code{strerror_r})
-instead.
-@item
This function is missing on some platforms:
NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, HP-UX 11.00, IRIX 6.5, Cygwin 1.7.
@item
On Windows and 32-bit AIX platforms, @code{wchar_t} is a 16-bit type and therefore cannot
accommodate all Unicode characters.
@item
+This function does not support the @samp{b} directive, required by ISO C23,
+on some platforms:
+glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+AIX 7.2, HP-UX 11, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
+@item
+The @code{%m} directive is not portable, use @code{%s} mapped to an
+argument of @code{strerror(errno)} (or a version of @code{strerror_r})
+instead.
+@item
When formatting an integer with grouping flag, this function inserts thousands
separators even in the "C" locale on some platforms:
NetBSD 5.1.
Portability problems not fixed by Gnulib:
@itemize
@item
-The @code{%m} directive is not portable, use @code{%s} mapped to an
-argument of @code{strerror(errno)} (or a version of @code{strerror_r})
-instead.
-@item
This function is missing on some platforms:
NetBSD 3.0, OpenBSD 3.8, Minix 3.1.8, HP-UX 11.00, IRIX 6.5.
@item
On Windows and 32-bit AIX platforms, @code{wchar_t} is a 16-bit type and therefore cannot
accommodate all Unicode characters.
@item
+This function does not support the @samp{b} directive, required by ISO C23,
+on some platforms:
+glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
+AIX 7.2, HP-UX 11, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
+@item
+The @code{%m} directive is not portable, use @code{%s} mapped to an
+argument of @code{strerror(errno)} (or a version of @code{strerror_r})
+instead.
+@item
When formatting an integer with grouping flag, this function inserts thousands
separators even in the "C" locale on some platforms:
NetBSD 5.1.
else
type = TYPE_INT;
break;
- case 'o': case 'u': case 'x': case 'X':
+ case 'b': case 'o': case 'u': case 'x': case 'X':
/* If 'unsigned long long' is larger than 'unsigned long': */
if (flags >= 16 || (flags & 4))
type = TYPE_ULONGLONGINT;
const char* precision_start;
const char* precision_end;
size_t precision_arg_index;
- char conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
+ char conversion; /* d i b o u x X f F e E g G a A c s p n U % but not C S */
size_t arg_index;
}
char_directive;
tmp_length = xsum (tmp_length, 1);
break;
+ case 'b':
+ if (type == TYPE_ULONGLONGINT)
+ tmp_length =
+ (unsigned int) (sizeof (unsigned long long) * CHAR_BIT)
+ + 1; /* turn floor into ceil */
+ else if (type == TYPE_ULONGINT)
+ tmp_length =
+ (unsigned int) (sizeof (unsigned long) * CHAR_BIT)
+ + 1; /* turn floor into ceil */
+ else
+ tmp_length =
+ (unsigned int) (sizeof (unsigned int) * CHAR_BIT)
+ + 1; /* turn floor into ceil */
+ if (tmp_length < precision)
+ tmp_length = precision;
+ /* Add 2, to account for a prefix from the alternate form. */
+ tmp_length = xsum (tmp_length, 2);
+ break;
+
case 'o':
if (type == TYPE_ULONGLONGINT)
tmp_length =
}
}
#endif
+#if NEED_PRINTF_DIRECTIVE_B
+ else if (dp->conversion == 'b')
+ {
+ arg_type type = a.arg[dp->arg_index].type;
+ int flags = dp->flags;
+ size_t width;
+ int has_precision;
+ size_t precision;
+ size_t tmp_length;
+ size_t count;
+ DCHAR_T tmpbuf[700];
+ DCHAR_T *tmp;
+ DCHAR_T *tmp_end;
+ DCHAR_T *tmp_start;
+ DCHAR_T *pad_ptr;
+ DCHAR_T *p;
+
+ width = 0;
+ if (dp->width_start != dp->width_end)
+ {
+ if (dp->width_arg_index != ARG_NONE)
+ {
+ int arg;
+
+ if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+ abort ();
+ arg = a.arg[dp->width_arg_index].a.a_int;
+ width = arg;
+ if (arg < 0)
+ {
+ /* "A negative field width is taken as a '-' flag
+ followed by a positive field width." */
+ flags |= FLAG_LEFT;
+ width = -width;
+ }
+ }
+ else
+ {
+ const FCHAR_T *digitp = dp->width_start;
+
+ do
+ width = xsum (xtimes (width, 10), *digitp++ - '0');
+ while (digitp != dp->width_end);
+ }
+ }
+
+ has_precision = 0;
+ precision = 0;
+ if (dp->precision_start != dp->precision_end)
+ {
+ if (dp->precision_arg_index != ARG_NONE)
+ {
+ int arg;
+
+ if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+ abort ();
+ arg = a.arg[dp->precision_arg_index].a.a_int;
+ /* "A negative precision is taken as if the precision
+ were omitted." */
+ if (arg >= 0)
+ {
+ precision = arg;
+ has_precision = 1;
+ }
+ }
+ else
+ {
+ const FCHAR_T *digitp = dp->precision_start + 1;
+
+ precision = 0;
+ while (digitp != dp->precision_end)
+ precision = xsum (xtimes (precision, 10), *digitp++ - '0');
+ has_precision = 1;
+ }
+ }
+
+ /* Allocate a temporary buffer of sufficient size. */
+ if (type == TYPE_ULONGLONGINT)
+ tmp_length =
+ (unsigned int) (sizeof (unsigned long long) * CHAR_BIT)
+ + 1; /* turn floor into ceil */
+ else if (type == TYPE_ULONGINT)
+ tmp_length =
+ (unsigned int) (sizeof (unsigned long) * CHAR_BIT)
+ + 1; /* turn floor into ceil */
+ else
+ tmp_length =
+ (unsigned int) (sizeof (unsigned int) * CHAR_BIT)
+ + 1; /* turn floor into ceil */
+ if (tmp_length < precision)
+ tmp_length = precision;
+ /* Add 2, to account for a prefix from the alternate form. */
+ tmp_length = xsum (tmp_length, 2);
+
+ if (tmp_length < width)
+ tmp_length = width;
+
+ if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
+ tmp = tmpbuf;
+ else
+ {
+ size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
+
+ if (size_overflow_p (tmp_memsize))
+ /* Overflow, would lead to out of memory. */
+ goto out_of_memory;
+ tmp = (DCHAR_T *) malloc (tmp_memsize);
+ if (tmp == NULL)
+ /* Out of memory. */
+ goto out_of_memory;
+ }
+
+ tmp_end = tmp + tmp_length;
+
+ unsigned long long arg =
+ (type == TYPE_ULONGLONGINT ? a.arg[dp->arg_index].a.a_ulonglongint :
+ type == TYPE_ULONGINT ? a.arg[dp->arg_index].a.a_ulongint :
+ a.arg[dp->arg_index].a.a_uint);
+ int need_prefix = ((flags & FLAG_ALT) && arg != 0);
+
+ p = tmp_end;
+ do
+ {
+ *--p = '0' + (arg & 1);
+ arg = arg >> 1;
+ }
+ while (arg != 0);
+
+ pad_ptr = p;
+
+ if (need_prefix)
+ {
+ *--p = 'b'; *--p = '0';
+ }
+ tmp_start = p;
+
+ /* The generated string now extends from tmp_start to tmp_end,
+ with the zero padding insertion point being at pad_ptr,
+ tmp_start <= pad_ptr <= tmp_end. */
+ count = tmp_end - tmp_start;
+
+ if (count < width)
+ {
+ size_t pad = width - count;
+
+ if (flags & FLAG_LEFT)
+ {
+ /* Pad with spaces on the right. */
+ for (p = tmp_start; p < tmp_end; p++)
+ *(p - pad) = *p;
+ for (p = tmp_end - pad; p < tmp_end; p++)
+ *p = ' ';
+ }
+ else if (flags & FLAG_ZERO)
+ {
+ /* Pad with zeroes. */
+ for (p = tmp_start; p < pad_ptr; p++)
+ *(p - pad) = *p;
+ for (p = pad_ptr - pad; p < pad_ptr; p++)
+ *p = '0';
+ }
+ else
+ {
+ /* Pad with spaces on the left. */
+ for (p = tmp_start - pad; p < tmp_start; p++)
+ *p = ' ';
+ }
+
+ tmp_start = tmp_start - pad;
+ }
+
+ count = tmp_end - tmp_start;
+
+ if (count > tmp_length)
+ /* tmp_length was incorrectly calculated - fix the
+ code above! */
+ abort ();
+
+ /* Make room for the result. */
+ if (count >= allocated - length)
+ {
+ size_t n = xsum (length, count);
+
+ ENSURE_ALLOCATION (n);
+ }
+
+ /* Append the result. */
+ memcpy (result + length, tmp_start, count * sizeof (DCHAR_T));
+ if (tmp != tmpbuf)
+ free (tmp);
+ length += count;
+ }
+#endif
#if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE
else if ((dp->conversion == 'a' || dp->conversion == 'A')
# if !(NEED_PRINTF_DIRECTIVE_A || (NEED_PRINTF_LONG_DOUBLE && NEED_PRINTF_DOUBLE))
switch (dp->conversion)
{
case 'd': case 'i': case 'u':
+ case 'b':
case 'o':
case 'x': case 'X': case 'p':
prec_ourselves = has_precision && (precision > 0);
const wchar_t* precision_start;
const wchar_t* precision_end;
size_t precision_arg_index;
- wchar_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
+ wchar_t conversion; /* d i b o u x X f F e E g G a A c s p n U % but not C S */
size_t arg_index;
}
wchar_t_directive;
-# dprintf-posix.m4 serial 3
+# dprintf-posix.m4 serial 4
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_INFINITE])
AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_B])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
*yes)
case "$gl_cv_func_printf_directive_a" in
*yes)
- case "$gl_cv_func_printf_directive_f" in
+ case "$gl_cv_func_printf_directive_b" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_ls" in
+ case "$gl_cv_func_printf_directive_n" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- # dprintf exists and is
- # already POSIX compliant.
- gl_cv_func_dprintf_posix=yes
+ case "$gl_cv_func_printf_enomem" in
+ *yes)
+ # dprintf exists and is
+ # already POSIX compliant.
+ gl_cv_func_dprintf_posix=yes
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
gl_PREREQ_VASNPRINTF_DIRECTIVE_A
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
-# fprintf-posix.m4 serial 14
+# fprintf-posix.m4 serial 15
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_INFINITE])
AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_B])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
*yes)
case "$gl_cv_func_printf_directive_a" in
*yes)
- case "$gl_cv_func_printf_directive_f" in
+ case "$gl_cv_func_printf_directive_b" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_ls" in
+ case "$gl_cv_func_printf_directive_n" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- # fprintf exists and is
- # already POSIX compliant.
- gl_cv_func_fprintf_posix=yes
+ case "$gl_cv_func_printf_enomem" in
+ *yes)
+ # fprintf exists and is
+ # already POSIX compliant.
+ gl_cv_func_fprintf_posix=yes
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
gl_PREREQ_VASNPRINTF_DIRECTIVE_A
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
-# obstack-printf-posix.m4 serial 4
+# obstack-printf-posix.m4 serial 5
dnl Copyright (C) 2008-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_INFINITE])
AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_B])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
*yes)
case "$gl_cv_func_printf_directive_a" in
*yes)
- case "$gl_cv_func_printf_directive_f" in
+ case "$gl_cv_func_printf_directive_b" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_ls" in
+ case "$gl_cv_func_printf_directive_n" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- # obstack_printf exists and is
- # already POSIX compliant.
- gl_cv_func_obstack_printf_posix=yes
+ case "$gl_cv_func_printf_enomem" in
+ *yes)
+ # obstack_printf exists and is
+ # already POSIX compliant.
+ gl_cv_func_obstack_printf_posix=yes
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
gl_PREREQ_VASNPRINTF_DIRECTIVE_A
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
-# printf.m4 serial 74
+# printf.m4 serial 75
dnl Copyright (C) 2003, 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
])
])
+dnl Test whether the *printf family of functions supports the 'b' conversion
+dnl specifier for binary output of integers.
+dnl (ISO C23)
+dnl Result is gl_cv_func_printf_directive_b.
+
+AC_DEFUN([gl_PRINTF_DIRECTIVE_B],
+[
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+ AC_CACHE_CHECK([whether printf supports the 'b' directive],
+ [gl_cv_func_printf_directive_b],
+ [
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <string.h>
+static char buf[100];
+int main ()
+{
+ int result = 0;
+ if (sprintf (buf, "%b %d", 12345, 33, 44, 55) < 0
+ || strcmp (buf, "11000000111001 33") != 0)
+ result |= 1;
+ return result;
+}]])],
+ [gl_cv_func_printf_directive_b=yes],
+ [gl_cv_func_printf_directive_b=no],
+ [
+ case "$host_os" in
+ # Guess no on glibc systems.
+ *-gnu* | gnu*) gl_cv_func_printf_directive_b="guessing no";;
+ # Guess no on musl systems.
+ *-musl* | midipix*) gl_cv_func_printf_directive_b="guessing no";;
+ # Guess no on Android.
+ linux*-android*) gl_cv_func_printf_directive_b="guessing no";;
+ # Guess no on native Windows.
+ mingw*) gl_cv_func_printf_directive_b="guessing no";;
+ # If we don't know, obey --enable-cross-guesses.
+ *) gl_cv_func_printf_directive_b="$gl_cross_guess_normal";;
+ esac
+ ])
+ ])
+])
+
dnl Test whether the *printf family of functions supports the %F format
dnl directive. (ISO C99, POSIX:2001)
dnl Result is gl_cv_func_printf_directive_f.
dnl 3 = gl_PRINTF_INFINITE
dnl 4 = gl_PRINTF_INFINITE_LONG_DOUBLE
dnl 5 = gl_PRINTF_DIRECTIVE_A
-dnl 6 = gl_PRINTF_DIRECTIVE_F
-dnl 7 = gl_PRINTF_DIRECTIVE_N
-dnl 8 = gl_PRINTF_DIRECTIVE_LS
-dnl 9 = gl_PRINTF_POSITIONS
-dnl 10 = gl_PRINTF_FLAG_GROUPING
-dnl 11 = gl_PRINTF_FLAG_LEFTADJUST
-dnl 12 = gl_PRINTF_FLAG_ZERO
-dnl 13 = gl_PRINTF_PRECISION
-dnl 14 = gl_PRINTF_ENOMEM
-dnl 15 = gl_SNPRINTF_PRESENCE
-dnl 16 = gl_SNPRINTF_TRUNCATION_C99
-dnl 17 = gl_SNPRINTF_RETVAL_C99
-dnl 18 = gl_SNPRINTF_DIRECTIVE_N
-dnl 19 = gl_SNPRINTF_SIZE1
-dnl 20 = gl_VSNPRINTF_ZEROSIZE_C99
+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
dnl 1 = checking whether printf supports size specifiers as in C99...
dnl 2 = checking whether printf supports 'long double' arguments...
dnl 3 = checking whether printf supports infinite 'double' arguments...
dnl 4 = checking whether printf supports infinite 'long double' arguments...
dnl 5 = checking whether printf supports the 'a' and 'A' directives...
-dnl 6 = checking whether printf supports the 'F' directive...
-dnl 7 = checking whether printf supports the 'n' directive...
-dnl 8 = checking whether printf supports the 'ls' directive...
-dnl 9 = checking whether printf supports POSIX/XSI format strings with positions...
-dnl 10 = checking whether printf supports the grouping flag...
-dnl 11 = checking whether printf supports the left-adjust flag correctly...
-dnl 12 = checking whether printf supports the zero flag correctly...
-dnl 13 = checking whether printf supports large precisions...
-dnl 14 = checking whether printf survives out-of-memory conditions...
-dnl 15 = checking for snprintf...
-dnl 16 = checking whether snprintf truncates the result as in C99...
-dnl 17 = checking whether snprintf returns a byte count as in C99...
-dnl 18 = checking whether snprintf fully supports the 'n' directive...
-dnl 19 = checking whether snprintf respects a size of 1...
-dnl 20 = checking whether vsnprintf respects a zero size as in C99...
+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
dnl . = yes, # = no.
dnl
-dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
-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
+dnl glibc 2.5 . . . . . # . . . . . . . . . . . . . . .
+dnl glibc 2.3.6 . . . . # # . . . . . . . . . . . . . . .
+dnl FreeBSD 13.0 . . . . # # . . . . . . . . # . . . . . .
+dnl FreeBSD 5.4, 6.1 . . . . # # . . . . . . # . # . . . . . .
+dnl Mac OS X 10.13.5 . . . # # # . # . . . . . . . . . . # . .
+dnl Mac OS X 10.5.8 . . . # # # . . . . . . # . . . . . . . .
+dnl Mac OS X 10.3.9 . . . . # # . . . . . . # . # . . . . . .
+dnl OpenBSD 6.0, 6.7 . . . . # # . . . . . . . . # . . . . . .
+dnl OpenBSD 3.9, 4.0 . . # # # # # . # . # . # . # . . . . . .
+dnl Cygwin 1.7.0 (2009) . . . # . # . . ? . . . . . ? . . . . . .
+dnl Cygwin 1.5.25 (2008) . . . # # # . . # . . . . . # . . . . . .
+dnl Cygwin 1.5.19 (2006) # . . # # # # . # . # . # # # . . . . . .
+dnl Solaris 11.4 . . # # # # . . # . . . # . . . . . . . .
+dnl Solaris 11.3 . . . . # # . . # . . . . . . . . . . . .
+dnl Solaris 11.0 . . # # # # . . # . . . # . . . . . . . .
+dnl Solaris 10 . . # # # # . . # . . . # # . . . . . . .
+dnl Solaris 2.6 ... 9 # . # # # # # . # . . . # # . . . # . . .
+dnl Solaris 2.5.1 # . # # # # # . # . . . # . . # # # # # #
+dnl AIX 7.1 . . # # # # . . . . . . # # . . . . . . .
+dnl AIX 5.2 . . # # # # . . . . . . # . . . . . . . .
+dnl AIX 4.3.2, 5.1 # . # # # # # . . . . . # . . . . # . . .
+dnl HP-UX 11.31 . . . . # # . . . . . . # . . . . # # . .
+dnl HP-UX 11.{00,11,23} # . . . # # # . . . . . # . . . . # # . #
+dnl HP-UX 10.20 # . # . # # # . ? . . # # . . . . # # ? #
+dnl IRIX 6.5 # . # # # # # . # . . . # . . . . # . . .
+dnl OSF/1 5.1 # . # # # # # . . . . . # . . . . # . . #
+dnl OSF/1 4.0d # . # # # # # . . . . . # . . # # # # # #
+dnl NetBSD 9.0 . . . . # # . . . . . . . . . . . . . . .
+dnl NetBSD 5.0 . . . # # # . . . . . . # . # . . . . . .
+dnl NetBSD 4.0 . ? ? ? ? # ? . ? . ? ? ? ? ? . . . ? ? ?
+dnl NetBSD 3.0 . . . . # # # . ? # # ? # . # . . . . . .
+dnl Haiku . . . # # # # . # . . . . . ? . . ? . . .
+dnl BeOS # # . # # # # . ? # . ? . # ? . . ? . . .
+dnl Android 4.3 . . # # # # # # # . # . # . # . . . # . .
+dnl old mingw / msvcrt # # # # # # # . . # # . # # ? . # # # . .
+dnl MSVC 9 # # # # # # # # . # # . # # ? # # # # . .
+dnl mingw 2009-2011 . # . # . # . . . # # . . . ? . . . . . .
+dnl mingw-w64 2011 # # # # # # # . . # # . # # ? . # # # . .
-# snprintf-posix.m4 serial 14
+# snprintf-posix.m4 serial 15
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_INFINITE])
AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_B])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
*yes)
case "$gl_cv_func_printf_directive_a" in
*yes)
- case "$gl_cv_func_printf_directive_f" in
+ case "$gl_cv_func_printf_directive_b" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_ls" in
+ case "$gl_cv_func_printf_directive_n" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- case "$gl_cv_func_snprintf_truncation_c99" in
+ case "$gl_cv_func_printf_enomem" in
*yes)
- case "$gl_cv_func_snprintf_retval_c99" in
+ case "$gl_cv_func_snprintf_truncation_c99" in
*yes)
- case "$gl_cv_func_snprintf_directive_n" in
+ case "$gl_cv_func_snprintf_retval_c99" in
*yes)
- case "$gl_cv_func_snprintf_size1" in
+ case "$gl_cv_func_snprintf_directive_n" in
*yes)
- case "$gl_cv_func_vsnprintf_zerosize_c99" in
+ case "$gl_cv_func_snprintf_size1" in
*yes)
- # snprintf exists and is
- # already POSIX compliant.
- gl_cv_func_snprintf_posix=yes
+ case "$gl_cv_func_vsnprintf_zerosize_c99" in
+ *yes)
+ # snprintf exists and is
+ # already POSIX compliant.
+ gl_cv_func_snprintf_posix=yes
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
gl_PREREQ_VASNPRINTF_DIRECTIVE_A
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
-# sprintf-posix.m4 serial 12
+# sprintf-posix.m4 serial 13
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_INFINITE])
AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_B])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
*yes)
case "$gl_cv_func_printf_directive_a" in
*yes)
- case "$gl_cv_func_printf_directive_f" in
+ case "$gl_cv_func_printf_directive_b" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_ls" in
+ case "$gl_cv_func_printf_directive_n" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- # sprintf exists and is
- # already POSIX compliant.
- gl_cv_func_sprintf_posix=yes
+ case "$gl_cv_func_printf_enomem" in
+ *yes)
+ # sprintf exists and is
+ # already POSIX compliant.
+ gl_cv_func_sprintf_posix=yes
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
gl_PREREQ_VASNPRINTF_DIRECTIVE_A
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
-# vasnprintf-posix.m4 serial 13
+# vasnprintf-posix.m4 serial 14
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_INFINITE])
AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_B])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
*yes)
case "$gl_cv_func_printf_directive_a" in
*yes)
- case "$gl_cv_func_printf_directive_f" in
+ case "$gl_cv_func_printf_directive_b" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_ls" in
+ case "$gl_cv_func_printf_directive_n" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- if test $ac_cv_func_vasnprintf = yes; then
- # vasnprintf exists and is
- # already POSIX compliant.
- gl_cv_func_vasnprintf_posix=yes
- fi
+ case "$gl_cv_func_printf_enomem" in
+ *yes)
+ if test $ac_cv_func_vasnprintf = yes; then
+ # vasnprintf exists and is
+ # already POSIX compliant.
+ gl_cv_func_vasnprintf_posix=yes
+ fi
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
gl_PREREQ_VASNPRINTF_DIRECTIVE_A
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
-# vasnprintf.m4 serial 40
+# vasnprintf.m4 serial 41
dnl Copyright (C) 2002-2004, 2006-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
esac
])
+# Extra prerequisites of lib/vasnprintf.c for supporting the 'b' directive.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_B],
+[
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_B])
+ case "$gl_cv_func_printf_directive_b" in
+ *yes)
+ ;;
+ *)
+ AC_DEFINE([NEED_PRINTF_DIRECTIVE_B], [1],
+ [Define if the vasnprintf implementation needs special code for
+ the 'b' directive.])
+ ;;
+ esac
+])
+
# Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive.
AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F],
[
gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
gl_PREREQ_VASNPRINTF_DIRECTIVE_A
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
-# vasnwprintf-posix.m4 serial 1
+# vasnwprintf-posix.m4 serial 2
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,
gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
gl_PREREQ_VASNPRINTF_DIRECTIVE_A
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
-# vasprintf-posix.m4 serial 13
+# vasprintf-posix.m4 serial 14
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_INFINITE])
AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_B])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
*yes)
case "$gl_cv_func_printf_directive_a" in
*yes)
- case "$gl_cv_func_printf_directive_f" in
+ case "$gl_cv_func_printf_directive_b" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_ls" in
+ case "$gl_cv_func_printf_directive_n" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- if test $ac_cv_func_vasprintf = yes; then
- # vasprintf exists and is
- # already POSIX compliant.
- gl_cv_func_vasprintf_posix=yes
- fi
+ case "$gl_cv_func_printf_enomem" in
+ *yes)
+ if test $ac_cv_func_vasprintf = yes; then
+ # vasprintf exists and is
+ # already POSIX compliant.
+ gl_cv_func_vasprintf_posix=yes
+ fi
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
gl_PREREQ_VASNPRINTF_DIRECTIVE_A
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
-# vdprintf-posix.m4 serial 3
+# vdprintf-posix.m4 serial 4
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_INFINITE])
AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_B])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
*yes)
case "$gl_cv_func_printf_directive_a" in
*yes)
- case "$gl_cv_func_printf_directive_f" in
+ case "$gl_cv_func_printf_directive_b" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_ls" in
+ case "$gl_cv_func_printf_directive_n" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- # vdprintf exists and is
- # already POSIX compliant.
- gl_cv_func_vdprintf_posix=yes
+ case "$gl_cv_func_printf_enomem" in
+ *yes)
+ # vdprintf exists and is
+ # already POSIX compliant.
+ gl_cv_func_vdprintf_posix=yes
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
gl_PREREQ_VASNPRINTF_DIRECTIVE_A
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
-# vfprintf-posix.m4 serial 14
+# vfprintf-posix.m4 serial 15
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_INFINITE])
AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_B])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
*yes)
case "$gl_cv_func_printf_directive_a" in
*yes)
- case "$gl_cv_func_printf_directive_f" in
+ case "$gl_cv_func_printf_directive_b" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_ls" in
+ case "$gl_cv_func_printf_directive_n" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- # vfprintf exists and is
- # already POSIX compliant.
- gl_cv_func_vfprintf_posix=yes
+ case "$gl_cv_func_printf_enomem" in
+ *yes)
+ # vfprintf exists and is
+ # already POSIX compliant.
+ gl_cv_func_vfprintf_posix=yes
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
gl_PREREQ_VASNPRINTF_DIRECTIVE_A
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
-# vsnprintf-posix.m4 serial 15
+# vsnprintf-posix.m4 serial 16
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_INFINITE])
AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_B])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
*yes)
case "$gl_cv_func_printf_directive_a" in
*yes)
- case "$gl_cv_func_printf_directive_f" in
+ case "$gl_cv_func_printf_directive_b" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_ls" in
+ case "$gl_cv_func_printf_directive_n" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- case "$gl_cv_func_snprintf_truncation_c99" in
+ case "$gl_cv_func_printf_enomem" in
*yes)
- case "$gl_cv_func_snprintf_retval_c99" in
+ case "$gl_cv_func_snprintf_truncation_c99" in
*yes)
- case "$gl_cv_func_snprintf_directive_n" in
+ case "$gl_cv_func_snprintf_retval_c99" in
*yes)
- case "$gl_cv_func_snprintf_size1" in
+ case "$gl_cv_func_snprintf_directive_n" in
*yes)
- case "$gl_cv_func_vsnprintf_zerosize_c99" in
+ case "$gl_cv_func_snprintf_size1" in
*yes)
- # vsnprintf exists and is
- # already POSIX compliant.
- gl_cv_func_vsnprintf_posix=yes
+ case "$gl_cv_func_vsnprintf_zerosize_c99" in
+ *yes)
+ # vsnprintf exists and is
+ # already POSIX compliant.
+ gl_cv_func_vsnprintf_posix=yes
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
gl_PREREQ_VASNPRINTF_DIRECTIVE_A
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
-# vsprintf-posix.m4 serial 12
+# vsprintf-posix.m4 serial 13
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_PRINTF_INFINITE])
AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_B])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
*yes)
case "$gl_cv_func_printf_directive_a" in
*yes)
- case "$gl_cv_func_printf_directive_f" in
+ case "$gl_cv_func_printf_directive_b" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_ls" in
+ case "$gl_cv_func_printf_directive_n" in
*yes)
- case "$gl_cv_func_printf_positions" in
+ case "$gl_cv_func_printf_directive_ls" in
*yes)
- case "$gl_cv_func_printf_flag_grouping" in
+ case "$gl_cv_func_printf_positions" in
*yes)
- case "$gl_cv_func_printf_flag_leftadjust" in
+ case "$gl_cv_func_printf_flag_grouping" in
*yes)
- case "$gl_cv_func_printf_flag_zero" in
+ case "$gl_cv_func_printf_flag_leftadjust" in
*yes)
- case "$gl_cv_func_printf_precision" in
+ case "$gl_cv_func_printf_flag_zero" in
*yes)
- case "$gl_cv_func_printf_enomem" in
+ case "$gl_cv_func_printf_precision" in
*yes)
- # vsprintf exists and is
- # already POSIX compliant.
- gl_cv_func_vsprintf_posix=yes
+ case "$gl_cv_func_printf_enomem" in
+ *yes)
+ # vsprintf exists and is
+ # already POSIX compliant.
+ gl_cv_func_vsprintf_posix=yes
+ ;;
+ esac
;;
esac
;;
gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
gl_PREREQ_VASNPRINTF_DIRECTIVE_A
+ gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
{ /* Positive infinity. */
int retval =
my_snprintf (result, sizeof (result), "%La %d", Infinityl (), 33, 44, 55);
+ /* Note: This assertion fails under valgrind.
+ Reported at <https://bugs.kde.org/show_bug.cgi?id=424044>. */
ASSERT (strcmp (result, "inf 33") == 0);
ASSERT (retval == strlen (result));
}
ASSERT (retval == strlen (result));
}
#endif
+
+ /* Test the support of the 'b' conversion specifier for binary output of
+ integers. */
+
+ { /* Zero. */
+ int retval =
+ my_snprintf (result, sizeof (result), "%b %d", 0, 33, 44, 55);
+ ASSERT (strcmp (result, "0 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
+ { /* A positive number. */
+ int retval =
+ my_snprintf (result, sizeof (result), "%b %d", 12345, 33, 44, 55);
+ ASSERT (strcmp (result, "11000000111001 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
+ { /* A large positive number. */
+ int retval =
+ my_snprintf (result, sizeof (result), "%b %d", 0xFFFFFFFEU, 33, 44, 55);
+ ASSERT (strcmp (result, "11111111111111111111111111111110 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
+ { /* Width. */
+ int retval =
+ my_snprintf (result, sizeof (result), "%20b %d", 12345, 33, 44, 55);
+ ASSERT (strcmp (result, " 11000000111001 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
+ { /* Width given as argument. */
+ int retval =
+ my_snprintf (result, sizeof (result), "%*b %d", 20, 12345, 33, 44, 55);
+ ASSERT (strcmp (result, " 11000000111001 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ int retval =
+ my_snprintf (result, sizeof (result), "%*b %d", -20, 12345, 33, 44, 55);
+ ASSERT (strcmp (result, "11000000111001 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
+ { /* FLAG_LEFT. */
+ int retval =
+ my_snprintf (result, sizeof (result), "%-20b %d", 12345, 33, 44, 55);
+ ASSERT (strcmp (result, "11000000111001 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
+ { /* FLAG_ALT with zero. */
+ int retval =
+ my_snprintf (result, sizeof (result), "%#b %d", 0, 33, 44, 55);
+ ASSERT (strcmp (result, "0 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
+ { /* FLAG_ALT with a positive number. */
+ int retval =
+ my_snprintf (result, sizeof (result), "%#b %d", 12345, 33, 44, 55);
+ ASSERT (strcmp (result, "0b11000000111001 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
}
{ /* Positive infinity. */
int retval =
my_sprintf (result, "%La %d", Infinityl (), 33, 44, 55);
+ /* Note: This assertion fails under valgrind.
+ Reported at <https://bugs.kde.org/show_bug.cgi?id=424044>. */
ASSERT (strcmp (result, "inf 33") == 0);
ASSERT (retval == strlen (result));
}
ASSERT (retval == strlen (result));
}
#endif
+
+ /* Test the support of the 'b' conversion specifier for binary output of
+ integers. */
+
+ { /* Zero. */
+ int retval =
+ my_sprintf (result, "%b %d", 0, 33, 44, 55);
+ ASSERT (strcmp (result, "0 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
+ { /* A positive number. */
+ int retval =
+ my_sprintf (result, "%b %d", 12345, 33, 44, 55);
+ ASSERT (strcmp (result, "11000000111001 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
+ { /* A large positive number. */
+ int retval =
+ my_sprintf (result, "%b %d", 0xFFFFFFFEU, 33, 44, 55);
+ ASSERT (strcmp (result, "11111111111111111111111111111110 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
+ { /* Width. */
+ int retval =
+ my_sprintf (result, "%20b %d", 12345, 33, 44, 55);
+ ASSERT (strcmp (result, " 11000000111001 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
+ { /* Width given as argument. */
+ int retval =
+ my_sprintf (result, "%*b %d", 20, 12345, 33, 44, 55);
+ ASSERT (strcmp (result, " 11000000111001 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ int retval =
+ my_sprintf (result, "%*b %d", -20, 12345, 33, 44, 55);
+ ASSERT (strcmp (result, "11000000111001 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
+ { /* FLAG_LEFT. */
+ int retval =
+ my_sprintf (result, "%-20b %d", 12345, 33, 44, 55);
+ ASSERT (strcmp (result, "11000000111001 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
+ { /* FLAG_ALT with zero. */
+ int retval =
+ my_sprintf (result, "%#b %d", 0, 33, 44, 55);
+ ASSERT (strcmp (result, "0 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
+
+ { /* FLAG_ALT with a positive number. */
+ int retval =
+ my_sprintf (result, "%#b %d", 12345, 33, 44, 55);
+ ASSERT (strcmp (result, "0b11000000111001 33") == 0);
+ ASSERT (retval == strlen (result));
+ }
}
char *result =
my_asnprintf (NULL, &length, "%La %d", Infinityl (), 33, 44, 55);
ASSERT (result != NULL);
+ /* Note: This assertion fails under valgrind.
+ Reported at <https://bugs.kde.org/show_bug.cgi?id=424044>. */
ASSERT (strcmp (result, "inf 33") == 0);
ASSERT (length == strlen (result));
free (result);
}
#endif
+ /* Test the support of the 'b' conversion specifier for binary output of
+ integers. */
+
+ { /* Zero. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "%b %d", 0, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "0 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+
+ { /* A positive number. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "%b %d", 12345, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "11000000111001 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+
+ { /* A large positive number. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "%b %d", 0xFFFFFFFEU, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "11111111111111111111111111111110 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+
+ { /* Width. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "%20b %d", 12345, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, " 11000000111001 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+
+ { /* Width given as argument. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "%*b %d", 20, 12345, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, " 11000000111001 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "%*b %d", -20, 12345, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "11000000111001 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+
+ { /* FLAG_LEFT. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "%-20b %d", 12345, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "11000000111001 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+
+ { /* FLAG_ALT with zero. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "%#b %d", 0, 33, 44, 55);
+ ASSERT (strcmp (result, "0 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+
+ { /* FLAG_ALT with a positive number. */
+ size_t length;
+ char *result =
+ my_asnprintf (NULL, &length, "%#b %d", 12345, 33, 44, 55);
+ ASSERT (strcmp (result, "0b11000000111001 33") == 0);
+ ASSERT (length == strlen (result));
+ free (result);
+ }
+
#if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) && !defined __UCLIBC__
/* Test that the 'I' flag is supported. */
{
wchar_t *result =
my_asnwprintf (NULL, &length, L"%La %d", Infinityl (), 33, 44, 55);
ASSERT (result != NULL);
+ /* Note: This assertion fails under valgrind.
+ Reported at <https://bugs.kde.org/show_bug.cgi?id=424044>. */
ASSERT (wcscmp (result, L"inf 33") == 0);
ASSERT (length == wcslen (result));
free (result);
}
#endif
+ /* Test the support of the 'b' conversion specifier for binary output of
+ integers. */
+
+ { /* Zero. */
+ size_t length;
+ wchar_t *result =
+ my_asnwprintf (NULL, &length, L"%b %d", 0, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (wcscmp (result, L"0 33") == 0);
+ ASSERT (length == wcslen (result));
+ free (result);
+ }
+
+ { /* A positive number. */
+ size_t length;
+ wchar_t *result =
+ my_asnwprintf (NULL, &length, L"%b %d", 12345, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (wcscmp (result, L"11000000111001 33") == 0);
+ ASSERT (length == wcslen (result));
+ free (result);
+ }
+
+ { /* A large positive number. */
+ size_t length;
+ wchar_t *result =
+ my_asnwprintf (NULL, &length, L"%b %d", 0xFFFFFFFEU, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (wcscmp (result, L"11111111111111111111111111111110 33") == 0);
+ ASSERT (length == wcslen (result));
+ free (result);
+ }
+
+ { /* Width. */
+ size_t length;
+ wchar_t *result =
+ my_asnwprintf (NULL, &length, L"%20b %d", 12345, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (wcscmp (result, L" 11000000111001 33") == 0);
+ ASSERT (length == wcslen (result));
+ free (result);
+ }
+
+ { /* Width given as argument. */
+ size_t length;
+ wchar_t *result =
+ my_asnwprintf (NULL, &length, L"%*b %d", 20, 12345, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (wcscmp (result, L" 11000000111001 33") == 0);
+ ASSERT (length == wcslen (result));
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ size_t length;
+ wchar_t *result =
+ my_asnwprintf (NULL, &length, L"%*b %d", -20, 12345, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (wcscmp (result, L"11000000111001 33") == 0);
+ ASSERT (length == wcslen (result));
+ free (result);
+ }
+
+ { /* FLAG_LEFT. */
+ size_t length;
+ wchar_t *result =
+ my_asnwprintf (NULL, &length, L"%-20b %d", 12345, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (wcscmp (result, L"11000000111001 33") == 0);
+ ASSERT (length == wcslen (result));
+ free (result);
+ }
+
+ { /* FLAG_ALT with zero. */
+ size_t length;
+ wchar_t *result =
+ my_asnwprintf (NULL, &length, L"%#b %d", 0, 33, 44, 55);
+ ASSERT (wcscmp (result, L"0 33") == 0);
+ ASSERT (length == wcslen (result));
+ free (result);
+ }
+
+ { /* FLAG_ALT with a positive number. */
+ size_t length;
+ wchar_t *result =
+ my_asnwprintf (NULL, &length, L"%#b %d", 12345, 33, 44, 55);
+ ASSERT (wcscmp (result, L"0b11000000111001 33") == 0);
+ ASSERT (length == wcslen (result));
+ free (result);
+ }
+
#if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) && !defined __UCLIBC__
/* Test that the 'I' flag is supported. */
{
int retval =
my_asprintf (&result, "%La %d", Infinityl (), 33, 44, 55);
ASSERT (result != NULL);
+ /* Note: This assertion fails under valgrind.
+ Reported at <https://bugs.kde.org/show_bug.cgi?id=424044>. */
ASSERT (strcmp (result, "inf 33") == 0);
ASSERT (retval == strlen (result));
free (result);
free (result);
}
#endif
+
+ /* Test the support of the 'b' conversion specifier for binary output of
+ integers. */
+
+ { /* Zero. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%b %d", 0, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "0 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
+
+ { /* A positive number. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%b %d", 12345, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "11000000111001 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
+
+ { /* A large positive number. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%b %d", 0xFFFFFFFEU, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "11111111111111111111111111111110 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
+
+ { /* Width. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%20b %d", 12345, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, " 11000000111001 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
+
+ { /* Width given as argument. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%*b %d", 20, 12345, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, " 11000000111001 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
+
+ { /* Negative width given as argument (cf. FLAG_LEFT below). */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%*b %d", -20, 12345, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "11000000111001 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
+
+ { /* FLAG_LEFT. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%-20b %d", 12345, 33, 44, 55);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "11000000111001 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
+
+ { /* FLAG_ALT with zero. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%#b %d", 0, 33, 44, 55);
+ ASSERT (strcmp (result, "0 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
+
+ { /* FLAG_ALT with a positive number. */
+ char *result;
+ int retval =
+ my_asprintf (&result, "%#b %d", 12345, 33, 44, 55);
+ ASSERT (strcmp (result, "0b11000000111001 33") == 0);
+ ASSERT (retval == strlen (result));
+ free (result);
+ }
}
static int