changeset 11219:aaeb2f86d096

Fix *printf behaviour regarding the %ls directive.
author Bruno Haible <bruno@clisp.org>
date Thu, 26 Feb 2009 12:54:20 +0100
parents d3d4cc78595e
children 96097ce626ee
files ChangeLog doc/glibc-functions/obstack_printf.texi doc/glibc-functions/obstack_vprintf.texi 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/dprintf-posix.m4 m4/fprintf-posix.m4 m4/obstack-printf-posix.m4 m4/printf.m4 m4/snprintf-posix.m4 m4/sprintf-posix.m4 m4/vasnprintf-posix.m4 m4/vasnprintf.m4 m4/vasprintf-posix.m4 m4/vdprintf-posix.m4 m4/vfprintf-posix.m4 m4/vsnprintf-posix.m4 m4/vsprintf-posix.m4
diffstat 25 files changed, 375 insertions(+), 184 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+2009-02-26  Bruno Haible  <bruno@clisp.org>
+
+	Fix *printf behaviour regarding the %ls directive.
+	* m4/printf.m4 (gl_PRINTF_DIRECTIVE_LS): New macro.
+	* lib/vasnprintf.c (local_wcslen, VASNPRINTF): Handle
+	NEED_PRINTF_DIRECTIVE_LS.
+	* m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_DIRECTIVE_LS): New macro.
+	(gl_PREREQ_VASNPRINTF_WITH_EXTRAS): Invoke it.
+	* m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_POSIX): Invoke
+	gl_PREREQ_VASNPRINTF_DIRECTIVE_LS and test its result. Invoke
+	gl_PREREQ_VASNPRINTF_DIRECTIVE_LS.
+	* m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_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.
+	* doc/posix-functions/fprintf.texi: Update.
+	* doc/posix-functions/printf.texi: Update.
+	* doc/posix-functions/snprintf.texi: Update.
+	* doc/posix-functions/sprintf.texi: Update.
+	* doc/posix-functions/vfprintf.texi: Update.
+	* doc/posix-functions/vprintf.texi: Update.
+	* doc/posix-functions/vsnprintf.texi: Update.
+	* doc/posix-functions/vsprintf.texi: Update.
+	* doc/glibc-functions/obstack_printf.texi: Update.
+	* doc/glibc-functions/obstack_vprintf.texi: Update.
+	Reported by Eric Blake.
+
 2009-02-25  Bruno Haible  <bruno@clisp.org>
 
 	* m4/mbrtowc.m4 (gl_MBRTOWC_NUL_RETVAL): Update guess for Solaris 8
--- a/doc/glibc-functions/obstack_printf.texi
+++ b/doc/glibc-functions/obstack_printf.texi
@@ -35,6 +35,9 @@
 NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, OSF/1 5.1, Solaris 9,
 Cygwin 1.5.x, mingw, BeOS.
 @item
+This function does not support the @samp{ls} directive on some platforms:
+OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku.
+@item
 This function does not support format directives that access arguments in an
 arbitrary order, such as @code{"%2$s"}, on some platforms:
 NetBSD 3.0, mingw, BeOS.
--- a/doc/glibc-functions/obstack_vprintf.texi
+++ b/doc/glibc-functions/obstack_vprintf.texi
@@ -35,6 +35,9 @@
 NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, OSF/1 5.1, Solaris 9,
 Cygwin 1.5.x, mingw, BeOS.
 @item
+This function does not support the @samp{ls} directive on some platforms:
+OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku.
+@item
 This function does not support format directives that access arguments in an
 arbitrary order, such as @code{"%2$s"}, on some platforms:
 NetBSD 3.0, mingw, BeOS.
--- a/doc/posix-functions/fprintf.texi
+++ b/doc/posix-functions/fprintf.texi
@@ -29,6 +29,9 @@
 NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, OSF/1 5.1, Solaris 9,
 Cygwin 1.5.x, mingw, BeOS.
 @item
+This function does not support the @samp{ls} directive on some platforms:
+OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku.
+@item
 This function does not support format directives that access arguments in an
 arbitrary order, such as @code{"%2$s"}, on some platforms:
 NetBSD 3.0, mingw, BeOS.
--- a/doc/posix-functions/printf.texi
+++ b/doc/posix-functions/printf.texi
@@ -29,6 +29,9 @@
 NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, OSF/1 5.1, Solaris 9,
 Cygwin 1.5.x, mingw, BeOS.
 @item
+This function does not support the @samp{ls} directive on some platforms:
+OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku.
+@item
 This function does not support format directives that access arguments in an
 arbitrary order, such as @code{"%2$s"}, on some platforms:
 NetBSD 3.0, mingw, BeOS.
--- a/doc/posix-functions/snprintf.texi
+++ b/doc/posix-functions/snprintf.texi
@@ -40,6 +40,9 @@
 NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, OSF/1 5.1, Solaris 9,
 Cygwin 1.5.x, mingw, BeOS.
 @item
+This function does not support the @samp{ls} directive on some platforms:
+OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku.
+@item
 This function does not support format directives that access arguments in an
 arbitrary order, such as @code{"%2$s"}, on some platforms:
 NetBSD 3.0, mingw, BeOS.
--- a/doc/posix-functions/sprintf.texi
+++ b/doc/posix-functions/sprintf.texi
@@ -29,6 +29,9 @@
 NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, OSF/1 5.1, Solaris 9,
 Cygwin 1.5.x, mingw, BeOS.
 @item
+This function does not support the @samp{ls} directive on some platforms:
+OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku.
+@item
 This function does not support format directives that access arguments in an
 arbitrary order, such as @code{"%2$s"}, on some platforms:
 NetBSD 3.0, mingw, BeOS.
--- a/doc/posix-functions/vfprintf.texi
+++ b/doc/posix-functions/vfprintf.texi
@@ -29,6 +29,9 @@
 NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, OSF/1 5.1, Solaris 9,
 Cygwin 1.5.x, mingw, BeOS.
 @item
+This function does not support the @samp{ls} directive on some platforms:
+OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku.
+@item
 This function does not support format directives that access arguments in an
 arbitrary order, such as @code{"%2$s"}, on some platforms:
 NetBSD 3.0, mingw, BeOS.
--- a/doc/posix-functions/vprintf.texi
+++ b/doc/posix-functions/vprintf.texi
@@ -29,6 +29,9 @@
 NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, OSF/1 5.1, Solaris 9,
 Cygwin 1.5.x, mingw, BeOS.
 @item
+This function does not support the @samp{ls} directive on some platforms:
+OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku.
+@item
 This function does not support format directives that access arguments in an
 arbitrary order, such as @code{"%2$s"}, on some platforms:
 NetBSD 3.0, mingw, BeOS.
--- a/doc/posix-functions/vsnprintf.texi
+++ b/doc/posix-functions/vsnprintf.texi
@@ -40,6 +40,9 @@
 NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, OSF/1 5.1, Solaris 9,
 Cygwin 1.5.x, mingw, BeOS.
 @item
+This function does not support the @samp{ls} directive on some platforms:
+OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku.
+@item
 This function does not support format directives that access arguments in an
 arbitrary order, such as @code{"%2$s"}, on some platforms:
 NetBSD 3.0, mingw, BeOS.
--- a/doc/posix-functions/vsprintf.texi
+++ b/doc/posix-functions/vsprintf.texi
@@ -29,6 +29,9 @@
 NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, OSF/1 5.1, Solaris 9,
 Cygwin 1.5.x, mingw, BeOS.
 @item
+This function does not support the @samp{ls} directive on some platforms:
+OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku.
+@item
 This function does not support format directives that access arguments in an
 arbitrary order, such as @code{"%2$s"}, on some platforms:
 NetBSD 3.0, mingw, BeOS.
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -210,7 +210,7 @@
 # endif
 #endif
 
-#if !USE_SNPRINTF && HAVE_WCHAR_T && (WIDE_CHAR_VERSION || DCHAR_IS_TCHAR)
+#if (!USE_SNPRINTF || NEED_PRINTF_DIRECTIVE_LS) && HAVE_WCHAR_T && (WIDE_CHAR_VERSION || DCHAR_IS_TCHAR)
 # if HAVE_WCSLEN
 #  define local_wcslen wcslen
 # else
@@ -2103,7 +2103,7 @@
 		  }
 	      }
 #endif
-#if !USE_SNPRINTF && HAVE_WCHAR_T
+#if (!USE_SNPRINTF || NEED_PRINTF_DIRECTIVE_LS) && HAVE_WCHAR_T
 	    else if (dp->conversion == 's'
 # if WIDE_CHAR_VERSION
 		     && a.arg[dp->arg_index].type != TYPE_WIDE_STRING
--- a/m4/dprintf-posix.m4
+++ b/m4/dprintf-posix.m4
@@ -1,4 +1,4 @@
-# dprintf-posix.m4 serial 1
+# dprintf-posix.m4 serial 2
 dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -13,6 +13,7 @@
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
   AC_REQUIRE([gl_PRINTF_POSITIONS])
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
@@ -36,21 +37,25 @@
                           *yes)
                             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
                                                     ;;
@@ -84,6 +89,7 @@
     gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
     gl_PREREQ_VASNPRINTF_DIRECTIVE_A
     gl_PREREQ_VASNPRINTF_DIRECTIVE_F
+    gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
     gl_PREREQ_VASNPRINTF_FLAG_GROUPING
     gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
     gl_PREREQ_VASNPRINTF_FLAG_ZERO
--- a/m4/fprintf-posix.m4
+++ b/m4/fprintf-posix.m4
@@ -1,4 +1,4 @@
-# fprintf-posix.m4 serial 13
+# fprintf-posix.m4 serial 14
 dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -13,6 +13,7 @@
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
   AC_REQUIRE([gl_PRINTF_POSITIONS])
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
@@ -34,23 +35,27 @@
                         *yes)
                           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
+                                                  esac
                                                   ;;
                                               esac
                                               ;;
@@ -81,6 +86,7 @@
     gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
     gl_PREREQ_VASNPRINTF_DIRECTIVE_A
     gl_PREREQ_VASNPRINTF_DIRECTIVE_F
+    gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
     gl_PREREQ_VASNPRINTF_FLAG_GROUPING
     gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
     gl_PREREQ_VASNPRINTF_FLAG_ZERO
--- a/m4/obstack-printf-posix.m4
+++ b/m4/obstack-printf-posix.m4
@@ -1,5 +1,5 @@
-# obstack-printf-posix.m4 serial 2
-dnl Copyright (C) 2008 Free Software Foundation, Inc.
+# obstack-printf-posix.m4 serial 3
+dnl Copyright (C) 2008-2009 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_REQUIRE([gl_PRINTF_DIRECTIVE_A])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
   AC_REQUIRE([gl_PRINTF_POSITIONS])
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
@@ -39,21 +40,25 @@
                           *yes)
                             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
                                                     ;;
@@ -87,6 +92,7 @@
     gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
     gl_PREREQ_VASNPRINTF_DIRECTIVE_A
     gl_PREREQ_VASNPRINTF_DIRECTIVE_F
+    gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
     gl_PREREQ_VASNPRINTF_FLAG_GROUPING
     gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
     gl_PREREQ_VASNPRINTF_FLAG_ZERO
--- a/m4/printf.m4
+++ b/m4/printf.m4
@@ -1,4 +1,4 @@
-# printf.m4 serial 28
+# printf.m4 serial 29
 dnl Copyright (C) 2003, 2007-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -612,6 +612,49 @@
     ])
 ])
 
+dnl Test whether the *printf family of functions supports the %ls format
+dnl directive.
+dnl Result is gl_cv_func_printf_directive_ls.
+
+AC_DEFUN([gl_PRINTF_DIRECTIVE_LS],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf supports the 'ls' directive],
+    [gl_cv_func_printf_directive_ls],
+    [
+      AC_TRY_RUN([
+/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
+   <wchar.h>.
+   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
+   included before <wchar.h>.  */
+#include <stddef.h>
+#include <stdio.h>
+#include <time.h>
+#include <wchar.h>
+#include <string.h>
+static wchar_t wstring[] = { 'a', 'b', 'c', 0 };
+int main ()
+{
+  char buf[100];
+  buf[0] = '\0';
+  sprintf (buf, "%ls", wstring);
+  return strcmp (buf, "abc") != 0;
+}], [gl_cv_func_printf_directive_ls=yes], [gl_cv_func_printf_directive_ls=no],
+      [
+changequote(,)dnl
+       case "$host_os" in
+         openbsd*)        gl_cv_func_printf_directive_ls="guessing no";;
+         solaris2.[1-6]*) gl_cv_func_printf_directive_ls="guessing no";;
+         irix*)           gl_cv_func_printf_directive_ls="guessing no";;
+         beos* | haiku*)  gl_cv_func_printf_directive_ls="guessing no";;
+         *)               gl_cv_func_printf_directive_ls="guessing yes";;
+       esac
+changequote([,])dnl
+      ])
+    ])
+])
+
 dnl Test whether the *printf family of functions supports POSIX/XSI format
 dnl strings with positions. (POSIX:2001)
 dnl Result is gl_cv_func_printf_positions.
@@ -1261,18 +1304,19 @@
 dnl 5 = gl_PRINTF_DIRECTIVE_A
 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_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_SNPRINTF_SIZE1
-dnl 19 = gl_VSNPRINTF_ZEROSIZE_C99
+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
 dnl 1 = checking whether printf supports size specifiers as in C99...
 dnl 2 = checking whether printf supports 'long double' arguments...
@@ -1281,42 +1325,44 @@
 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 POSIX/XSI format strings with positions...
-dnl 9 = checking whether printf supports the grouping flag...
-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 snprintf respects a size of 1...
-dnl 19 = checking whether vsnprintf respects a zero size as in C99...
+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
 dnl . = yes, # = no.
 dnl
-dnl                                  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19
-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   Haiku                          .  .  .  #  #  #  .  .  .  .  .  .  ?  .  .  .  .  .  .
-dnl   BeOS                           #  #  .  #  #  #  .  #  .  ?  .  #  ?  .  .  .  .  .  .
-dnl   mingw                          #  #  #  #  #  #  .  #  #  .  #  #  ?  .  #  #  #  .  .
+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 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 7 ... 9                #  .  #  #  #  #  .  .  .  .  .  #  .  .  .  .  .  .  .  .
+dnl   Solaris 2.6                    #  .  #  #  #  #  .  #  .  .  .  #  .  .  .  .  .  .  .  .
+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   Haiku                          .  .  .  #  #  #  .  #  .  .  .  .  .  ?  .  .  .  .  .  .
+dnl   BeOS                           #  #  .  #  #  #  .  ?  #  .  ?  .  #  ?  .  .  .  .  .  .
+dnl   mingw                          #  #  #  #  #  #  .  .  #  #  .  #  #  ?  .  #  #  #  .  .
--- a/m4/snprintf-posix.m4
+++ b/m4/snprintf-posix.m4
@@ -1,5 +1,5 @@
-# snprintf-posix.m4 serial 13
-dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# snprintf-posix.m4 serial 14
+dnl Copyright (C) 2007-2009 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.
@@ -13,6 +13,7 @@
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
   AC_REQUIRE([gl_PRINTF_POSITIONS])
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
@@ -41,31 +42,35 @@
                           *yes)
                             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
                                                                         ;;
@@ -109,6 +114,7 @@
     gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
     gl_PREREQ_VASNPRINTF_DIRECTIVE_A
     gl_PREREQ_VASNPRINTF_DIRECTIVE_F
+    gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
     gl_PREREQ_VASNPRINTF_FLAG_GROUPING
     gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
     gl_PREREQ_VASNPRINTF_FLAG_ZERO
--- a/m4/sprintf-posix.m4
+++ b/m4/sprintf-posix.m4
@@ -1,5 +1,5 @@
-# sprintf-posix.m4 serial 11
-dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# sprintf-posix.m4 serial 12
+dnl Copyright (C) 2007-2009 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.
@@ -13,6 +13,7 @@
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
   AC_REQUIRE([gl_PRINTF_POSITIONS])
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
@@ -34,21 +35,25 @@
                         *yes)
                           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
                                                   ;;
@@ -81,6 +86,7 @@
     gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
     gl_PREREQ_VASNPRINTF_DIRECTIVE_A
     gl_PREREQ_VASNPRINTF_DIRECTIVE_F
+    gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
     gl_PREREQ_VASNPRINTF_FLAG_GROUPING
     gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
     gl_PREREQ_VASNPRINTF_FLAG_ZERO
--- a/m4/vasnprintf-posix.m4
+++ b/m4/vasnprintf-posix.m4
@@ -1,5 +1,5 @@
-# vasnprintf-posix.m4 serial 12
-dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# vasnprintf-posix.m4 serial 13
+dnl Copyright (C) 2007-2009 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.
@@ -13,6 +13,7 @@
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
   AC_REQUIRE([gl_PRINTF_POSITIONS])
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
@@ -35,23 +36,27 @@
                         *yes)
                           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
                                                   ;;
@@ -84,6 +89,7 @@
     gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
     gl_PREREQ_VASNPRINTF_DIRECTIVE_A
     gl_PREREQ_VASNPRINTF_DIRECTIVE_F
+    gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
     gl_PREREQ_VASNPRINTF_FLAG_GROUPING
     gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
     gl_PREREQ_VASNPRINTF_FLAG_ZERO
--- a/m4/vasnprintf.m4
+++ b/m4/vasnprintf.m4
@@ -1,4 +1,4 @@
-# vasnprintf.m4 serial 27
+# vasnprintf.m4 serial 28
 dnl Copyright (C) 2002-2004, 2006-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -150,6 +150,21 @@
   esac
 ])
 
+# Extra prerequisites of lib/vasnprintf.c for supporting the 'ls' directive.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LS],
+[
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
+  case "$gl_cv_func_printf_directive_ls" in
+    *yes)
+      ;;
+    *)
+      AC_DEFINE([NEED_PRINTF_DIRECTIVE_LS], [1],
+        [Define if the vasnprintf implementation needs special code for
+         the 'ls' directive.])
+      ;;
+  esac
+])
+
 # Extra prerequisites of lib/vasnprintf.c for supporting the ' flag.
 AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
 [
@@ -247,6 +262,7 @@
   gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
   gl_PREREQ_VASNPRINTF_DIRECTIVE_A
   gl_PREREQ_VASNPRINTF_DIRECTIVE_F
+  gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
   gl_PREREQ_VASNPRINTF_FLAG_GROUPING
   gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
   gl_PREREQ_VASNPRINTF_FLAG_ZERO
--- a/m4/vasprintf-posix.m4
+++ b/m4/vasprintf-posix.m4
@@ -1,5 +1,5 @@
-# vasprintf-posix.m4 serial 12
-dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# vasprintf-posix.m4 serial 13
+dnl Copyright (C) 2007-2009 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.
@@ -13,6 +13,7 @@
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
   AC_REQUIRE([gl_PRINTF_POSITIONS])
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
@@ -35,23 +36,27 @@
                         *yes)
                           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
                                                   ;;
@@ -84,6 +89,7 @@
     gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
     gl_PREREQ_VASNPRINTF_DIRECTIVE_A
     gl_PREREQ_VASNPRINTF_DIRECTIVE_F
+    gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
     gl_PREREQ_VASNPRINTF_FLAG_GROUPING
     gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
     gl_PREREQ_VASNPRINTF_FLAG_ZERO
--- a/m4/vdprintf-posix.m4
+++ b/m4/vdprintf-posix.m4
@@ -1,4 +1,4 @@
-# vdprintf-posix.m4 serial 1
+# vdprintf-posix.m4 serial 2
 dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -13,6 +13,7 @@
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
   AC_REQUIRE([gl_PRINTF_POSITIONS])
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
@@ -36,21 +37,25 @@
                           *yes)
                             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
                                                     ;;
@@ -84,6 +89,7 @@
     gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
     gl_PREREQ_VASNPRINTF_DIRECTIVE_A
     gl_PREREQ_VASNPRINTF_DIRECTIVE_F
+    gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
     gl_PREREQ_VASNPRINTF_FLAG_GROUPING
     gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
     gl_PREREQ_VASNPRINTF_FLAG_ZERO
--- a/m4/vfprintf-posix.m4
+++ b/m4/vfprintf-posix.m4
@@ -1,4 +1,4 @@
-# vfprintf-posix.m4 serial 13
+# vfprintf-posix.m4 serial 14
 dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -13,6 +13,7 @@
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
   AC_REQUIRE([gl_PRINTF_POSITIONS])
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
@@ -34,21 +35,25 @@
                         *yes)
                           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
                                                   ;;
@@ -81,6 +86,7 @@
     gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
     gl_PREREQ_VASNPRINTF_DIRECTIVE_A
     gl_PREREQ_VASNPRINTF_DIRECTIVE_F
+    gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
     gl_PREREQ_VASNPRINTF_FLAG_GROUPING
     gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
     gl_PREREQ_VASNPRINTF_FLAG_ZERO
--- a/m4/vsnprintf-posix.m4
+++ b/m4/vsnprintf-posix.m4
@@ -1,5 +1,5 @@
-# vsnprintf-posix.m4 serial 13
-dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# vsnprintf-posix.m4 serial 14
+dnl Copyright (C) 2007-2009 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.
@@ -13,6 +13,7 @@
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
   AC_REQUIRE([gl_PRINTF_POSITIONS])
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
@@ -42,31 +43,35 @@
                           *yes)
                             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
                                                                         ;;
@@ -110,6 +115,7 @@
     gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
     gl_PREREQ_VASNPRINTF_DIRECTIVE_A
     gl_PREREQ_VASNPRINTF_DIRECTIVE_F
+    gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
     gl_PREREQ_VASNPRINTF_FLAG_GROUPING
     gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
     gl_PREREQ_VASNPRINTF_FLAG_ZERO
--- a/m4/vsprintf-posix.m4
+++ b/m4/vsprintf-posix.m4
@@ -1,5 +1,5 @@
-# vsprintf-posix.m4 serial 11
-dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# vsprintf-posix.m4 serial 12
+dnl Copyright (C) 2007-2009 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.
@@ -13,6 +13,7 @@
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
   AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
+  AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
   AC_REQUIRE([gl_PRINTF_POSITIONS])
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
@@ -34,21 +35,25 @@
                         *yes)
                           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
                                                   ;;
@@ -81,6 +86,7 @@
     gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
     gl_PREREQ_VASNPRINTF_DIRECTIVE_A
     gl_PREREQ_VASNPRINTF_DIRECTIVE_F
+    gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
     gl_PREREQ_VASNPRINTF_FLAG_GROUPING
     gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
     gl_PREREQ_VASNPRINTF_FLAG_ZERO