Fix *printf behaviour regarding the left-adjust flag on HP-UX 10.20.
authorBruno Haible <bruno@clisp.org>
Thu, 7 Feb 2008 01:08:13 +0000 (02:08 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 7 Feb 2008 01:08:13 +0000 (02:08 +0100)
24 files changed:
ChangeLog
doc/posix-functions/fprintf.texi
doc/posix-functions/printf.texi
doc/posix-functions/snprintf.texi
doc/posix-functions/sprintf.texi
doc/posix-functions/vfprintf.texi
doc/posix-functions/vprintf.texi
doc/posix-functions/vsnprintf.texi
doc/posix-functions/vsprintf.texi
lib/vasnprintf.c
m4/fprintf-posix.m4
m4/printf.m4
m4/snprintf-posix.m4
m4/sprintf-posix.m4
m4/vasnprintf-posix.m4
m4/vasnprintf.m4
m4/vasprintf-posix.m4
m4/vfprintf-posix.m4
m4/vsnprintf-posix.m4
m4/vsprintf-posix.m4
tests/test-snprintf-posix.h
tests/test-sprintf-posix.h
tests/test-vasnprintf-posix.c
tests/test-vasprintf-posix.c

index f82387d41d4c894d1fed0e9f7a210ca16a51cf5f..4dd70fcc9eb781d3ed24a48de0b9230f82c010f6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,35 @@
+2008-02-06  Bruno Haible  <bruno@clisp.org>
+
+       Fix *printf behaviour regarding the left-adjust flag on HP-UX 10.20.
+       * m4/printf.m4 (gl_PRINTF_FLAG_LEFTADJUST): New macro.
+       * lib/vasnprintf.c (VASNPRINTF): Handle NEED_PRINTF_FLAG_LEFTADJUST.
+       * m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST): New macro.
+       (gl_PREREQ_VASNPRINTF_WITH_EXTRAS): Invoke it.
+       * m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_POSIX): Invoke
+       gl_PRINTF_FLAG_LEFTADJUST and test its result. Invoke
+       gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST.
+       * 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/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-vasnprintf-posix.c (test_function): Add testcases for the
+       left-adjust flag.
+       * tests/test-snprintf-posix.h (test_function): Likewise.
+       * tests/test-sprintf-posix.h (test_function): Likewise.
+       * tests/test-vasprintf-posix.c (test_function): Likewise.
+       * doc/functions/fprintf.texi: Update.
+       * doc/functions/printf.texi: Update.
+       * doc/functions/snprintf.texi: Update.
+       * doc/functions/sprintf.texi: Update.
+       * doc/functions/vfprintf.texi: Update.
+       * doc/functions/vprintf.texi: Update.
+       * doc/functions/vsnprintf.texi: Update.
+       * doc/functions/vsprintf.texi: Update.
+       Reported by Peter Fales <psfales@alcatel-lucent.com>.
+
 2008-02-06  Bruno Haible  <bruno@clisp.org>
 
        Fix bug introduced on 2008-01-26.
index 2b04fd467b1dc97bcccc5786daf9a0a0eac70155..e147ef5cf4a7e821bc397463d66e6397aa699622 100644 (file)
@@ -34,6 +34,10 @@ NetBSD 3.0, mingw, BeOS.
 This function doesn't support the @code{'} flag on some platforms:
 NetBSD 3.0, Cygwin 2006, mingw.
 @item
+This function behaves incorrectly when a @samp{-} flag and a negative width
+are specified together, on some platforms:
+HP-UX 10.20.
+@item
 printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes) on some platforms:
 MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, AIX 5.2, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 2007, mingw.
index 6ce2c04c2158c78e8669784d26d320b916b8686c..fff430ad68a06015f930592717209d8462ad9eea 100644 (file)
@@ -34,6 +34,10 @@ NetBSD 3.0, mingw, BeOS.
 This function doesn't support the @code{'} flag on some platforms:
 NetBSD 3.0, Cygwin 2006, mingw.
 @item
+This function behaves incorrectly when a @samp{-} flag and a negative width
+are specified together, on some platforms:
+HP-UX 10.20.
+@item
 printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes) on some platforms:
 MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, AIX 5.2, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 2007, mingw.
index 43ca802dbaf7dfbbee47f7e333117b383f989ffb..66ef6a936778f39b5becd79a2b9c97cc483fedf9 100644 (file)
@@ -41,6 +41,10 @@ NetBSD 3.0, mingw, BeOS.
 This function doesn't support the @code{'} flag on some platforms:
 NetBSD 3.0, Cygwin 2006, mingw.
 @item
+This function behaves incorrectly when a @samp{-} flag and a negative width
+are specified together, on some platforms:
+HP-UX 10.20.
+@item
 printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes) on some platforms:
 MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, AIX 5.2, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 2007, mingw.
index 405110d77c55658376c1ba50afb3ebdaa5c181cc..3c8f21ddfcc7a83af324b536328dde4041d316b9 100644 (file)
@@ -34,6 +34,10 @@ NetBSD 3.0, mingw, BeOS.
 This function doesn't support the @code{'} flag on some platforms:
 NetBSD 3.0, Cygwin 2006, mingw.
 @item
+This function behaves incorrectly when a @samp{-} flag and a negative width
+are specified together, on some platforms:
+HP-UX 10.20.
+@item
 printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes) on some platforms:
 MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, AIX 5.2, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 2007, mingw.
index 1ff23743a574a1e2d4c7d1878ac9685570c19036..9c984ecb233db82f01c3193401db858a869e44b7 100644 (file)
@@ -34,6 +34,10 @@ NetBSD 3.0, mingw, BeOS.
 This function doesn't support the @code{'} flag on some platforms:
 NetBSD 3.0, Cygwin 2006, mingw.
 @item
+This function behaves incorrectly when a @samp{-} flag and a negative width
+are specified together, on some platforms:
+HP-UX 10.20.
+@item
 printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes) on some platforms:
 MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, AIX 5.2, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 2007, mingw.
index 0c6f494574a3c7597dbf6fcb13cec897584eed93..e214cc5c7fcfdb6df21aa4f6c647b0efa5f91d20 100644 (file)
@@ -34,6 +34,10 @@ NetBSD 3.0, mingw, BeOS.
 This function doesn't support the @code{'} flag on some platforms:
 NetBSD 3.0, Cygwin 2006, mingw.
 @item
+This function behaves incorrectly when a @samp{-} flag and a negative width
+are specified together, on some platforms:
+HP-UX 10.20.
+@item
 printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes) on some platforms:
 MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, AIX 5.2, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 2007, mingw.
index 645ae70209ea168735d23cd62371fb4d92cc700c..f3477f09fb1f308e8655fd3612ca434662e6bc1d 100644 (file)
@@ -41,6 +41,10 @@ NetBSD 3.0, mingw, BeOS.
 This function doesn't support the @code{'} flag on some platforms:
 NetBSD 3.0, Cygwin 2006, mingw.
 @item
+This function behaves incorrectly when a @samp{-} flag and a negative width
+are specified together, on some platforms:
+HP-UX 10.20.
+@item
 printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes) on some platforms:
 MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, AIX 5.2, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 2007, mingw.
index afe7a2cced5104de481f456b2646c66278a1adff..a28a13bcd9767cfc52f1efd15727d07eb1e8ba2c 100644 (file)
@@ -34,6 +34,10 @@ NetBSD 3.0, mingw, BeOS.
 This function doesn't support the @code{'} flag on some platforms:
 NetBSD 3.0, Cygwin 2006, mingw.
 @item
+This function behaves incorrectly when a @samp{-} flag and a negative width
+are specified together, on some platforms:
+HP-UX 10.20.
+@item
 printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes) on some platforms:
 MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, AIX 5.2, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 2007, mingw.
index 1a74a44b540a1edb68c4fb4ea1cc62c8b7a5f479..8377d31eb591687186815e1de5cf973aac465120 100644 (file)
@@ -3566,7 +3566,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
              {
                arg_type type = a.arg[dp->arg_index].type;
                int flags = dp->flags;
-#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
                int has_width;
                size_t width;
 #endif
@@ -3579,7 +3579,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 #else
 #              define prec_ourselves 0
 #endif
-#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+#if NEED_PRINTF_FLAG_LEFTADJUST
+#              define pad_ourselves 1
+#elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
                int pad_ourselves;
 #else
 #              define pad_ourselves 0
@@ -3593,7 +3595,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                TCHAR_T *tmp;
 #endif
 
-#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
                has_width = 0;
                width = 0;
                if (dp->width_start != dp->width_end)
@@ -3883,7 +3885,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 #endif
 
                /* Decide whether to perform the padding ourselves.  */
-#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+#if !NEED_PRINTF_FLAG_LEFTADJUST && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION)
                switch (dp->conversion)
                  {
 # if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
@@ -4494,7 +4496,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                    /* Here count <= allocated - length.  */
 
                    /* Perform padding.  */
-#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
                    if (pad_ourselves && has_width)
                      {
                        size_t w;
index 287889b17d4cae0afdf5c67aef1136e4a6e8d534..0eb19fc498c6272b98bcbe3292f399250c28a4da 100644 (file)
@@ -1,5 +1,5 @@
-# fprintf-posix.m4 serial 9
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# fprintf-posix.m4 serial 10
+dnl Copyright (C) 2007-2008 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 with or without modifications, as long as this notice is preserved.
@@ -16,6 +16,7 @@ AC_DEFUN([gl_FUNC_FPRINTF_POSIX],
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
   AC_REQUIRE([gl_PRINTF_POSITIONS])
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
+  AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
   AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
   AC_REQUIRE([gl_PRINTF_PRECISION])
   AC_REQUIRE([gl_PRINTF_ENOMEM])
@@ -38,15 +39,19 @@ AC_DEFUN([gl_FUNC_FPRINTF_POSIX],
                                 *yes)
                                   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
                                               ;;
@@ -78,6 +83,7 @@ AC_DEFUN([gl_FUNC_FPRINTF_POSIX],
     gl_PREREQ_VASNPRINTF_DIRECTIVE_A
     gl_PREREQ_VASNPRINTF_DIRECTIVE_F
     gl_PREREQ_VASNPRINTF_FLAG_GROUPING
+    gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
     gl_PREREQ_VASNPRINTF_FLAG_ZERO
     gl_PREREQ_VASNPRINTF_PRECISION
     gl_PREREQ_VASNPRINTF_ENOMEM
index 37bf905201e9794f6484725e5be118b96f9d87d1..b6f82b5a3c46c4a2f4ca05eaca773c30cb6d120c 100644 (file)
@@ -1,5 +1,5 @@
-# printf.m4 serial 21
-dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+# printf.m4 serial 22
+dnl Copyright (C) 2003, 2007-2008 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 with or without modifications, as long as this notice is preserved.
@@ -684,6 +684,47 @@ changequote([,])dnl
     ])
 ])
 
+dnl Test whether the *printf family of functions supports the - flag correctly.
+dnl (ISO C99.) See
+dnl <http://lists.gnu.org/archive/html/bug-coreutils/2008-02/msg00035.html>
+dnl Result is gl_cv_func_printf_flag_leftadjust.
+
+AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf supports the left-adjust flag correctly],
+    [gl_cv_func_printf_flag_leftadjust],
+    [
+      AC_TRY_RUN([
+#include <stdio.h>
+#include <string.h>
+static char buf[100];
+int main ()
+{
+  /* Check that a '-' flag is not annihilated by a negative width.  */
+  if (sprintf (buf, "a%-*sc", -3, "b") < 0
+      || strcmp (buf, "ab  c") != 0)
+    return 1;
+  return 0;
+}],
+        [gl_cv_func_printf_flag_leftadjust=yes],
+        [gl_cv_func_printf_flag_leftadjust=no],
+        [
+changequote(,)dnl
+         case "$host_os" in
+                    # Guess yes on HP-UX 11.
+           hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";;
+                    # Guess no on HP-UX 10 and older.
+           hpux*)   gl_cv_func_printf_flag_leftadjust="guessing no";;
+                    # Guess yes otherwise.
+           *)       gl_cv_func_printf_flag_leftadjust="guessing yes";;
+         esac
+changequote([,])dnl
+        ])
+    ])
+])
+
 dnl Test whether the *printf family of functions supports padding of non-finite
 dnl values with the 0 flag correctly. (ISO C99 + TC1 + TC2.) See
 dnl <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html>
@@ -1185,14 +1226,15 @@ dnl 6 = gl_PRINTF_DIRECTIVE_F
 dnl 7 = gl_PRINTF_DIRECTIVE_N
 dnl 8 = gl_PRINTF_POSITIONS
 dnl 9 = gl_PRINTF_FLAG_GROUPING
-dnl 10 = gl_PRINTF_FLAG_ZERO
-dnl 11 = gl_PRINTF_PRECISION
-dnl 12 = gl_PRINTF_ENOMEM
-dnl 13 = gl_SNPRINTF_PRESENCE
-dnl 14 = gl_SNPRINTF_TRUNCATION_C99
-dnl 15 = gl_SNPRINTF_RETVAL_C99
-dnl 16 = gl_SNPRINTF_DIRECTIVE_N
-dnl 17 = gl_VSNPRINTF_ZEROSIZE_C99
+dnl 10 = gl_PRINTF_FLAG_LEFTADJUST
+dnl 11 = gl_PRINTF_FLAG_ZERO
+dnl 12 = gl_PRINTF_PRECISION
+dnl 13 = gl_PRINTF_ENOMEM
+dnl 14 = gl_SNPRINTF_PRESENCE
+dnl 15 = gl_SNPRINTF_TRUNCATION_C99
+dnl 16 = gl_SNPRINTF_RETVAL_C99
+dnl 17 = gl_SNPRINTF_DIRECTIVE_N
+dnl 18 = 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...
@@ -1203,36 +1245,38 @@ dnl 6 = checking whether printf supports the 'F' directive...
 dnl 7 = checking whether printf supports the 'n' directive...
 dnl 8 = checking whether printf supports POSIX/XSI format strings with positions...
 dnl 9 = checking whether printf supports the grouping flag...
-dnl 10 = checking whether printf supports the zero flag correctly...
-dnl 11 = checking whether printf supports large precisions...
-dnl 12 = checking whether printf survives out-of-memory conditions...
-dnl 13 = checking for snprintf...
-dnl 14 = checking whether snprintf truncates the result as in C99...
-dnl 15 = checking whether snprintf returns a byte count as in C99...
-dnl 16 = checking whether snprintf fully supports the 'n' directive...
-dnl 17 = checking whether vsnprintf respects a zero size as in C99...
+dnl 10 = checking whether printf supports the left-adjust flag correctly...
+dnl 11 = checking whether printf supports the zero flag correctly...
+dnl 12 = checking whether printf supports large precisions...
+dnl 13 = checking whether printf survives out-of-memory conditions...
+dnl 14 = checking for snprintf...
+dnl 15 = checking whether snprintf truncates the result as in C99...
+dnl 16 = checking whether snprintf returns a byte count as in C99...
+dnl 17 = checking whether snprintf fully supports the 'n' directive...
+dnl 18 = 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
-dnl   glibc 2.5                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
-dnl   glibc 2.3.6                    .  .  .  .  #  .  .  .  .  .  .  .  .  .  .  .  .
-dnl   FreeBSD 5.4, 6.1               .  .  .  .  #  .  .  .  .  #  .  #  .  .  .  .  .
-dnl   MacOS X 10.3.9                 .  .  .  .  #  .  .  .  .  #  .  #  .  .  .  .  .
-dnl   OpenBSD 3.9, 4.0               .  ?  ?  ?  #  ?  .  .  ?  ?  ?  ?  .  .  .  ?  ?
-dnl   Cygwin 2007 (= Cygwin 1.5.24)  .  .  .  .  #  #  .  .  .  #  ?  ?  .  .  .  .  .
-dnl   Cygwin 2006 (= Cygwin 1.5.19)  #  .  .  .  #  #  .  .  #  #  ?  ?  .  .  .  .  .
-dnl   Solaris 10                     .  .  #  #  #  .  .  .  .  #  .  .  .  .  .  .  .
-dnl   Solaris 2.6 ... 9              #  .  #  #  #  #  .  .  .  #  .  .  .  .  .  .  .
-dnl   Solaris 2.5.1                  #  .  #  #  #  #  .  .  .  #  .  .  #  #  #  #  #
-dnl   AIX 5.2                        .  .  #  #  #  .  .  .  .  #  .  .  .  .  .  .  .
-dnl   AIX 4.3.2, 5.1                 #  .  #  #  #  #  .  .  .  #  .  .  .  .  .  .  .
-dnl   HP-UX 11.31                    .  .  .  .  #  .  .  .  .  #  .  .  .  .  #  #  .
-dnl   HP-UX 10.20, 11.{00,11,23}     #  .  .  .  #  #  .  .  .  #  .  .  .  .  #  #  #
-dnl   IRIX 6.5                       #  .  #  #  #  #  .  .  .  #  .  .  .  .  #  .  .
-dnl   OSF/1 5.1                      #  .  #  #  #  #  .  .  .  #  .  .  .  .  #  .  #
-dnl   OSF/1 4.0d                     #  .  #  #  #  #  .  .  .  #  .  .  #  #  #  #  #
-dnl   NetBSD 4.0                     .  ?  ?  ?  ?  ?  .  .  ?  ?  ?  ?  .  .  .  ?  ?
-dnl   NetBSD 3.0                     .  .  .  .  #  #  .  #  #  #  .  #  .  .  .  .  .
-dnl   BeOS                           #  #  .  #  #  #  .  #  .  .  #  ?  .  .  .  .  .
-dnl   mingw                          #  #  #  #  #  #  .  #  #  #  #  ?  .  #  #  #  .
+dnl                                  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18
+dnl   glibc 2.5                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
+dnl   glibc 2.3.6                    .  .  .  .  #  .  .  .  .  .  .  .  .  .  .  .  .  .
+dnl   FreeBSD 5.4, 6.1               .  .  .  .  #  .  .  .  .  .  #  .  #  .  .  .  .  .
+dnl   MacOS X 10.3.9                 .  .  .  .  #  .  .  .  .  .  #  .  #  .  .  .  .  .
+dnl   OpenBSD 3.9, 4.0               .  .  #  #  #  #  .  .  #  .  #  .  #  .  .  .  .  .
+dnl   Cygwin 2007 (= Cygwin 1.5.24)  .  .  .  .  #  #  .  .  .  ?  #  ?  ?  .  .  .  .  .
+dnl   Cygwin 2006 (= Cygwin 1.5.19)  #  .  .  .  #  #  .  .  #  ?  #  ?  ?  .  .  .  .  .
+dnl   Solaris 10                     .  .  #  #  #  .  .  .  .  .  #  .  .  .  .  .  .  .
+dnl   Solaris 2.6 ... 9              #  .  #  #  #  #  .  .  .  .  #  .  .  .  .  .  .  .
+dnl   Solaris 2.5.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 4.0                     .  ?  ?  ?  ?  ?  .  .  ?  ?  ?  ?  ?  .  .  .  ?  ?
+dnl   NetBSD 3.0                     .  .  .  .  #  #  .  #  #  ?  #  .  #  .  .  .  .  .
+dnl   BeOS                           #  #  .  #  #  #  .  #  .  ?  .  #  ?  .  .  .  .  .
+dnl   mingw                          #  #  #  #  #  #  .  #  #  .  #  #  ?  .  #  #  #  .
index 666812f3986ff02e2a416244378f13ea5e5b3035..5df43ff5da160b8717b9657fe7332546175cfac2 100644 (file)
@@ -1,5 +1,5 @@
-# snprintf-posix.m4 serial 10
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# snprintf-posix.m4 serial 11
+dnl Copyright (C) 2007-2008 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 with or without modifications, as long as this notice is preserved.
@@ -16,6 +16,7 @@ AC_DEFUN([gl_FUNC_SNPRINTF_POSIX],
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
   AC_REQUIRE([gl_PRINTF_POSITIONS])
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
+  AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
   AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
   AC_REQUIRE([gl_PRINTF_PRECISION])
   AC_REQUIRE([gl_PRINTF_ENOMEM])
@@ -44,23 +45,27 @@ AC_DEFUN([gl_FUNC_SNPRINTF_POSIX],
                                   *yes)
                                     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_vsnprintf_zerosize_c99" in
+                                                                case "$gl_cv_func_snprintf_directive_n" 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
                                                                 ;;
@@ -101,6 +106,7 @@ AC_DEFUN([gl_FUNC_SNPRINTF_POSIX],
     gl_PREREQ_VASNPRINTF_DIRECTIVE_A
     gl_PREREQ_VASNPRINTF_DIRECTIVE_F
     gl_PREREQ_VASNPRINTF_FLAG_GROUPING
+    gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
     gl_PREREQ_VASNPRINTF_FLAG_ZERO
     gl_PREREQ_VASNPRINTF_PRECISION
     gl_PREREQ_VASNPRINTF_ENOMEM
index 494b9307bafcf6ac730b836573d3739f0d75af0d..b75438643e4c72daaa688564ac6dc6d47634e62c 100644 (file)
@@ -1,5 +1,5 @@
-# sprintf-posix.m4 serial 9
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# sprintf-posix.m4 serial 10
+dnl Copyright (C) 2007-2008 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 with or without modifications, as long as this notice is preserved.
@@ -16,6 +16,7 @@ AC_DEFUN([gl_FUNC_SPRINTF_POSIX],
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
   AC_REQUIRE([gl_PRINTF_POSITIONS])
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
+  AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
   AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
   AC_REQUIRE([gl_PRINTF_PRECISION])
   AC_REQUIRE([gl_PRINTF_ENOMEM])
@@ -38,15 +39,19 @@ AC_DEFUN([gl_FUNC_SPRINTF_POSIX],
                                 *yes)
                                   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
                                               ;;
@@ -78,6 +83,7 @@ AC_DEFUN([gl_FUNC_SPRINTF_POSIX],
     gl_PREREQ_VASNPRINTF_DIRECTIVE_A
     gl_PREREQ_VASNPRINTF_DIRECTIVE_F
     gl_PREREQ_VASNPRINTF_FLAG_GROUPING
+    gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
     gl_PREREQ_VASNPRINTF_FLAG_ZERO
     gl_PREREQ_VASNPRINTF_PRECISION
     gl_PREREQ_VASNPRINTF_ENOMEM
index d28c8986bb8e772a6cad0b44ca8363d2fdb224cd..81797cfb8fbeb930a774318bf105e973b338ca67 100644 (file)
@@ -1,5 +1,5 @@
-# vasnprintf-posix.m4 serial 10
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# vasnprintf-posix.m4 serial 11
+dnl Copyright (C) 2007-2008 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 with or without modifications, as long as this notice is preserved.
@@ -16,6 +16,7 @@ AC_DEFUN([gl_FUNC_VASNPRINTF_POSIX],
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
   AC_REQUIRE([gl_PRINTF_POSITIONS])
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
+  AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
   AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
   AC_REQUIRE([gl_PRINTF_PRECISION])
   AC_REQUIRE([gl_PRINTF_ENOMEM])
@@ -39,17 +40,21 @@ AC_DEFUN([gl_FUNC_VASNPRINTF_POSIX],
                                 *yes)
                                   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
                                               ;;
@@ -81,6 +86,7 @@ AC_DEFUN([gl_FUNC_VASNPRINTF_POSIX],
     gl_PREREQ_VASNPRINTF_DIRECTIVE_A
     gl_PREREQ_VASNPRINTF_DIRECTIVE_F
     gl_PREREQ_VASNPRINTF_FLAG_GROUPING
+    gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
     gl_PREREQ_VASNPRINTF_FLAG_ZERO
     gl_PREREQ_VASNPRINTF_PRECISION
     gl_PREREQ_VASNPRINTF_ENOMEM
index 6449a9c57f1f05255d3ebb6d944d3dc4ac1c0a04..c4d3f4fa07187d7898b2adb76a79cdc1917be8ea 100644 (file)
@@ -1,5 +1,5 @@
-# vasnprintf.m4 serial 23
-dnl Copyright (C) 2002-2004, 2006-2007 Free Software Foundation, Inc.
+# vasnprintf.m4 serial 24
+dnl Copyright (C) 2002-2004, 2006-2008 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 with or without modifications, as long as this notice is preserved.
@@ -166,6 +166,21 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
   esac
 ])
 
+# Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST],
+[
+  AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
+  case "$gl_cv_func_printf_flag_leftadjust" in
+    *yes)
+      ;;
+    *)
+      AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], 1,
+        [Define if the vasnprintf implementation needs special code for the
+         '-' flag.])
+      ;;
+  esac
+])
+
 # Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag.
 AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO],
 [
@@ -234,6 +249,7 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS],
   gl_PREREQ_VASNPRINTF_DIRECTIVE_A
   gl_PREREQ_VASNPRINTF_DIRECTIVE_F
   gl_PREREQ_VASNPRINTF_FLAG_GROUPING
+  gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
   gl_PREREQ_VASNPRINTF_FLAG_ZERO
   gl_PREREQ_VASNPRINTF_PRECISION
   gl_PREREQ_VASNPRINTF_ENOMEM
index cba0fdc265659b79cd59bf9670fa39659c005753..ce419f275906529788156109652a97574602845d 100644 (file)
@@ -1,5 +1,5 @@
-# vasprintf-posix.m4 serial 10
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# vasprintf-posix.m4 serial 11
+dnl Copyright (C) 2007-2008 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 with or without modifications, as long as this notice is preserved.
@@ -16,6 +16,7 @@ AC_DEFUN([gl_FUNC_VASPRINTF_POSIX],
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
   AC_REQUIRE([gl_PRINTF_POSITIONS])
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
+  AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
   AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
   AC_REQUIRE([gl_PRINTF_PRECISION])
   AC_REQUIRE([gl_PRINTF_ENOMEM])
@@ -39,17 +40,21 @@ AC_DEFUN([gl_FUNC_VASPRINTF_POSIX],
                                 *yes)
                                   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
                                               ;;
@@ -81,6 +86,7 @@ AC_DEFUN([gl_FUNC_VASPRINTF_POSIX],
     gl_PREREQ_VASNPRINTF_DIRECTIVE_A
     gl_PREREQ_VASNPRINTF_DIRECTIVE_F
     gl_PREREQ_VASNPRINTF_FLAG_GROUPING
+    gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
     gl_PREREQ_VASNPRINTF_FLAG_ZERO
     gl_PREREQ_VASNPRINTF_PRECISION
     gl_PREREQ_VASNPRINTF_ENOMEM
index b6690ec6a84d8b3475acaae471b7e55ef0bafeac..b6a18b7120b23c95ada3f34c5d829cb68e0a53cf 100644 (file)
@@ -1,5 +1,5 @@
-# vfprintf-posix.m4 serial 9
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# vfprintf-posix.m4 serial 10
+dnl Copyright (C) 2007-2008 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 with or without modifications, as long as this notice is preserved.
@@ -16,6 +16,7 @@ AC_DEFUN([gl_FUNC_VFPRINTF_POSIX],
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
   AC_REQUIRE([gl_PRINTF_POSITIONS])
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
+  AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
   AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
   AC_REQUIRE([gl_PRINTF_PRECISION])
   AC_REQUIRE([gl_PRINTF_ENOMEM])
@@ -38,15 +39,19 @@ AC_DEFUN([gl_FUNC_VFPRINTF_POSIX],
                                 *yes)
                                   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
                                               ;;
@@ -78,6 +83,7 @@ AC_DEFUN([gl_FUNC_VFPRINTF_POSIX],
     gl_PREREQ_VASNPRINTF_DIRECTIVE_A
     gl_PREREQ_VASNPRINTF_DIRECTIVE_F
     gl_PREREQ_VASNPRINTF_FLAG_GROUPING
+    gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
     gl_PREREQ_VASNPRINTF_FLAG_ZERO
     gl_PREREQ_VASNPRINTF_PRECISION
     gl_PREREQ_VASNPRINTF_ENOMEM
index 8004f657cef02651847907ff876b12d9619db0d5..29efc27221f233ccb4accfdcdfb69c30175bab17 100644 (file)
@@ -1,5 +1,5 @@
-# vsnprintf-posix.m4 serial 10
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# vsnprintf-posix.m4 serial 11
+dnl Copyright (C) 2007-2008 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 with or without modifications, as long as this notice is preserved.
@@ -16,6 +16,7 @@ AC_DEFUN([gl_FUNC_VSNPRINTF_POSIX],
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
   AC_REQUIRE([gl_PRINTF_POSITIONS])
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
+  AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
   AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
   AC_REQUIRE([gl_PRINTF_PRECISION])
   AC_REQUIRE([gl_PRINTF_ENOMEM])
@@ -45,23 +46,27 @@ AC_DEFUN([gl_FUNC_VSNPRINTF_POSIX],
                                   *yes)
                                     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_vsnprintf_zerosize_c99" in
+                                                                case "$gl_cv_func_snprintf_directive_n" 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
                                                                 ;;
@@ -102,6 +107,7 @@ AC_DEFUN([gl_FUNC_VSNPRINTF_POSIX],
     gl_PREREQ_VASNPRINTF_DIRECTIVE_A
     gl_PREREQ_VASNPRINTF_DIRECTIVE_F
     gl_PREREQ_VASNPRINTF_FLAG_GROUPING
+    gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
     gl_PREREQ_VASNPRINTF_FLAG_ZERO
     gl_PREREQ_VASNPRINTF_PRECISION
     gl_PREREQ_VASNPRINTF_ENOMEM
index a218559d0ac7d79c5ca41554b955522558215a53..c8ce2c86c69b565d9a6f1840986f37ae3a5ef04e 100644 (file)
@@ -1,5 +1,5 @@
-# vsprintf-posix.m4 serial 9
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# vsprintf-posix.m4 serial 10
+dnl Copyright (C) 2007-2008 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 with or without modifications, as long as this notice is preserved.
@@ -16,6 +16,7 @@ AC_DEFUN([gl_FUNC_VSPRINTF_POSIX],
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
   AC_REQUIRE([gl_PRINTF_POSITIONS])
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
+  AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
   AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
   AC_REQUIRE([gl_PRINTF_PRECISION])
   AC_REQUIRE([gl_PRINTF_ENOMEM])
@@ -38,15 +39,19 @@ AC_DEFUN([gl_FUNC_VSPRINTF_POSIX],
                                 *yes)
                                   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
                                               ;;
@@ -78,6 +83,7 @@ AC_DEFUN([gl_FUNC_VSPRINTF_POSIX],
     gl_PREREQ_VASNPRINTF_DIRECTIVE_A
     gl_PREREQ_VASNPRINTF_DIRECTIVE_F
     gl_PREREQ_VASNPRINTF_FLAG_GROUPING
+    gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
     gl_PREREQ_VASNPRINTF_FLAG_ZERO
     gl_PREREQ_VASNPRINTF_PRECISION
     gl_PREREQ_VASNPRINTF_ENOMEM
index 6698cd83015966d5d73d51c70a733e02a1208a6b..94f5e671c4e03566068d71ca60dc2cb9206e60a6 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of POSIX compatible vsnprintf() and snprintf() functions.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007-2008 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
@@ -2786,6 +2786,32 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
     ASSERT (retval == strlen (result));
   }
 
+  /* Test the support of the left-adjust flag.  */
+
+  {
+    char result[100];
+    int retval =
+      my_snprintf (result, sizeof (result), "a%*sc", -3, "b");
+    ASSERT (strcmp (result, "ab  c") == 0);
+    ASSERT (retval == strlen (result));
+  }
+
+  {
+    char result[100];
+    int retval =
+      my_snprintf (result, sizeof (result), "a%-*sc", 3, "b");
+    ASSERT (strcmp (result, "ab  c") == 0);
+    ASSERT (retval == strlen (result));
+  }
+
+  {
+    char result[100];
+    int retval =
+      my_snprintf (result, sizeof (result), "a%-*sc", -3, "b");
+    ASSERT (strcmp (result, "ab  c") == 0);
+    ASSERT (retval == strlen (result));
+  }
+
   /* Test the support of large precision.  */
 
   {
index 7f9ca5c712701dc15c8d1f41dcc45a2d77e9a621..35e9d47bcc002ef9109092ad37cf22af55cbd2a0 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of POSIX compatible vsprintf() and sprintf() functions.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007-2008 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
@@ -2760,6 +2760,32 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
     ASSERT (retval == strlen (result));
   }
 
+  /* Test the support of the left-adjust flag.  */
+
+  {
+    char result[1000];
+    int retval =
+      my_sprintf (result, "a%*sc", -3, "b");
+    ASSERT (strcmp (result, "ab  c") == 0);
+    ASSERT (retval == strlen (result));
+  }
+
+  {
+    char result[1000];
+    int retval =
+      my_sprintf (result, "a%-*sc", 3, "b");
+    ASSERT (strcmp (result, "ab  c") == 0);
+    ASSERT (retval == strlen (result));
+  }
+
+  {
+    char result[1000];
+    int retval =
+      my_sprintf (result, "a%-*sc", -3, "b");
+    ASSERT (strcmp (result, "ab  c") == 0);
+    ASSERT (retval == strlen (result));
+  }
+
   /* Test the support of large precision.  */
 
   {
index 8ee630199388af221733a597bf4f5cdc56ded0b9..e947cc79fb0df32f9109f2e147b5c8e7ea260e0c 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of POSIX compatible vasnprintf() and asnprintf() functions.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007-2008 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
@@ -3253,6 +3253,38 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
     free (result);
   }
 
+  /* Test the support of the left-adjust flag.  */
+
+  {
+    size_t length;
+    char *result =
+      my_asnprintf (NULL, &length, "a%*sc", -3, "b");
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "ab  c") == 0);
+    ASSERT (length == strlen (result));
+    free (result);
+  }
+
+  {
+    size_t length;
+    char *result =
+      my_asnprintf (NULL, &length, "a%-*sc", 3, "b");
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "ab  c") == 0);
+    ASSERT (length == strlen (result));
+    free (result);
+  }
+
+  {
+    size_t length;
+    char *result =
+      my_asnprintf (NULL, &length, "a%-*sc", -3, "b");
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "ab  c") == 0);
+    ASSERT (length == strlen (result));
+    free (result);
+  }
+
   /* Test the support of large precision.  */
 
   {
index 37a6db6fbe2f416f701510054aedd464f38c149f..68da28c817ac5316ee606f8be7b1324b8e2597e6 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of POSIX compatible vasprintf() and asprintf() functions.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007-2008 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
@@ -3234,6 +3234,38 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
     free (result);
   }
 
+  /* Test the support of the left-adjust flag.  */
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "a%*sc", -3, "b");
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "ab  c") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "a%-*sc", 3, "b");
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "ab  c") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
+  {
+    char *result;
+    int retval =
+      my_asprintf (&result, "a%-*sc", -3, "b");
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "ab  c") == 0);
+    ASSERT (retval == strlen (result));
+    free (result);
+  }
+
   /* Test the support of large precision.  */
 
   {