[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r3532 - in /fsf/trunk/libc: ./ elf/ include/ inet/ libio/ libio/bits/ locale/programs/ misc/bits/ stdio-common/ sysdeps/gene...



Author: eglibc
Date: Wed Sep 19 00:03:42 2007
New Revision: 3532

Log:
Import glibc-mainline for 2007-09-19

Added:
    fsf/trunk/libc/stdio-common/isoc99_fscanf.c
    fsf/trunk/libc/stdio-common/isoc99_scanf.c
    fsf/trunk/libc/stdio-common/isoc99_sscanf.c
    fsf/trunk/libc/stdio-common/isoc99_vfscanf.c
    fsf/trunk/libc/stdio-common/isoc99_vscanf.c
    fsf/trunk/libc/stdio-common/isoc99_vsscanf.c
    fsf/trunk/libc/stdio-common/scanf13.c
    fsf/trunk/libc/stdio-common/scanf14.c
    fsf/trunk/libc/stdio-common/scanf15.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_fscanf.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_fwscanf.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_scanf.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_sscanf.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_swscanf.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vfscanf.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vfwscanf.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vscanf.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vsscanf.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vswscanf.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vwscanf.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_wscanf.c
    fsf/trunk/libc/wcsmbs/isoc99_fwscanf.c
    fsf/trunk/libc/wcsmbs/isoc99_swscanf.c
    fsf/trunk/libc/wcsmbs/isoc99_vfwscanf.c
    fsf/trunk/libc/wcsmbs/isoc99_vswscanf.c
    fsf/trunk/libc/wcsmbs/isoc99_vwscanf.c
    fsf/trunk/libc/wcsmbs/isoc99_wscanf.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/elf/dl-lookup.c
    fsf/trunk/libc/elf/dl-object.c
    fsf/trunk/libc/elf/dl-runtime.c
    fsf/trunk/libc/elf/dl-sym.c
    fsf/trunk/libc/include/link.h
    fsf/trunk/libc/include/stdio.h
    fsf/trunk/libc/include/wchar.h
    fsf/trunk/libc/inet/tst-network.c
    fsf/trunk/libc/libio/bits/stdio-ldbl.h
    fsf/trunk/libc/libio/libio.h
    fsf/trunk/libc/libio/libioP.h
    fsf/trunk/libc/libio/stdio.h
    fsf/trunk/libc/locale/programs/charmap-dir.c
    fsf/trunk/libc/misc/bits/syslog.h
    fsf/trunk/libc/stdio-common/Makefile
    fsf/trunk/libc/stdio-common/Versions
    fsf/trunk/libc/stdio-common/vfscanf.c
    fsf/trunk/libc/sysdeps/generic/ldsodefs.h
    fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/Makefile
    fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/Versions
    fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
    fsf/trunk/libc/sysdeps/sparc/sparc32/elf/start.S
    fsf/trunk/libc/sysdeps/sparc/sparc64/elf/start.S
    fsf/trunk/libc/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
    fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
    fsf/trunk/libc/sysdeps/unix/sysv/linux/syscalls.list
    fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
    fsf/trunk/libc/wcsmbs/Makefile
    fsf/trunk/libc/wcsmbs/Versions
    fsf/trunk/libc/wcsmbs/bits/wchar-ldbl.h
    fsf/trunk/libc/wcsmbs/wchar.h

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Wed Sep 19 00:03:42 2007
@@ -1,3 +1,169 @@
+2007-09-19  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* misc/bits/syslog.h (syslog): Remove extraneous argument from
+	the inline, pass __USE_FORTIFY_LEVEL - 1 as second argument to
+	__syslog_chk.
+
+2007-09-18  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* locale/programs/charmap-dir.c (charmap_aliases): Use %ms instead of
+	%as in fscanf format strings.
+
+	* sysdeps/sparc/sparc32/elf/start.S: Remove cfi_* markup.
+	* sysdeps/sparc/sparc64/elf/start.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/clone.S (__thread_start): Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/clone.S (__thread_start): Likewise.
+
+	* sysdeps/generic/ldsodefs.h (DL_LOOKUP_GSCOPE_LOCK): New definition.
+	* elf/dl-runtime.c (_dl_fixup, _dl_profile_fixup): Or in
+	DL_LOOKUP_GSCOPE_LOCK into flags after THREAD_GSCOPE_SET_FLAG ().
+	* elf/dl-sym.c (do_sym): Likewise.
+	* include/link.h (struct link_map): Add l_serial field.
+	* elf/dl-object.c (_dl_new_object): Initialize l_serial.
+	* elf/dl-lookup.c (add_dependency): Add flags argument.
+	Remember map->l_serial, if DL_LOOKUP_GSCOPE_LOCK is among
+	flags, use THREAD_GSCOPE_RESET_FLAG before and
+	THREAD_GSCOPE_SET_FLAG after
+	__rtld_lock_lock_recursive (GL(dl_load_lock)) to avoid deadlock.
+	Don't dereference map until it has been found on some list.
+	If map->l_serial changed, return -1.
+
+2007-09-17  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* include/stdio.h (__isoc99_fscanf, __isoc99_scanf,
+	__isoc99_sscanf, __isoc99_vscanf): New prototypes.
+	(__isoc99_vsscanf, __isoc99_vfscanf): New prototypes, add
+	libc_hidden_proto.
+	* include/wchar.h (__isoc99_fwscanf, __isoc99_wscanf,
+	__isoc99_swscanf, __isoc99_vwscanf): New prototypes.
+	(__isoc99_vswscanf, __isoc99_vfwscanf): New prototypes,
+	add libc_hidden_proto.
+	* libio/stdio.h (fscanf, scanf, sscanf, vfscanf, vscanf,
+	vsscanf): Redirect to __isoc99_* if strict ISO C99 or POSIX
+	conformance requested.
+	* wcsmbs/wchar.h (fwscanf, wscanf, swscanf, vfwscanf, vwscanf,
+	vswscanf): Redirect to __isoc99_* if strict ISO C99 or POSIX
+	conformance requested.
+	* libio/bits/stdio-ldbl.h (fscanf, scanf, sscanf, vfscanf, vscanf,
+	vsscanf): Redirect to __nldbl___isoc99_* if strict ISO C99 or POSIX
+	conformance requested.
+	* wcsmbs/bits/wchar-ldbl.h (fwscanf, wscanf, swscanf, vfwscanf,
+	vwscanf, vswscanf): Redirect to __nldbl___isoc99_* if strict
+	ISO C99 or POSIX conformance requested.
+	* stdio-common/Versions (libc): Export __isoc99_scanf@@GLIBC_2.7,
+	__isoc99_vscanf@@GLIBC_2.7, __isoc99_fscanf@@GLIBC_2.7,
+	__isoc99_vfscanf@@GLIBC_2.7, __isoc99_sscanf@@GLIBC_2.7
+	and __isoc99_vsscanf@@GLIBC_2.7.
+	* stdio-common/Makefile (routines): Add isoc99_scanf, isoc99_vscanf,
+	isoc99_fscanf, isoc99_vfscanf, isoc99_sscanf and isoc99_vsscanf.
+	(tests): Add scanf14.
+	(CFLAGS-vfprintf.c, CFLAGS-fprintf.c, CFLAGS-printf.c,
+	CFLAGS-vfwprintf.c, CFLAGS-vfscanf.c, CFLAGS-vfwscanf.c,
+	CFLAGS-fscanf.c, CFLAGS-scanf.c, CFLAGS-isoc99_vfscanf.c,
+	CFLAGS-isoc99_vscanf.c, CFLAGS-isoc99_fscanf.c,
+	CFLAGS-isoc99_scanf.c): Add $(exceptions).
+	(CFLAGS-scanf15.c): Add various -I paths to prevent the compiler
+	from using internal headers.
+	* wcsmbs/Versions (libc): Export __isoc99_wscanf@@GLIBC_2.7,
+	__isoc99_vwscanf@@GLIBC_2.7, __isoc99_fwscanf@@GLIBC_2.7,
+	__isoc99_vfwscanf@@GLIBC_2.7, __isoc99_swscanf@@GLIBC_2.7
+	and __isoc99_vswscanf@@GLIBC_2.7.
+	* wcsmbs/Makefile (routines): Add isoc99_wscanf, isoc99_vwscanf,
+	isoc99_fwscanf, isoc99_vfwscanf, isoc99_swscanf and isoc99_vswscanf.
+	(CFLAGS-isoc99_wscanf.c, CFLAGS-isoc99_fwscanf.c,
+	CFLAGS-isoc99_vwscanf.c, CFLAGS-isoc99_vfwscanf.c): Add $(exceptions).
+	(CPPFLAGS): Add -D_IO_MTSAFE_IO if needed.
+	* stdio-common/isoc99_scanf.c: New file.
+	* stdio-common/isoc99_vsscanf.c: New file.
+	* stdio-common/isoc99_vscanf.c: New file.
+	* stdio-common/isoc99_vfscanf.c: New file.
+	* stdio-common/isoc99_fscanf.c: New file.
+	* stdio-common/isoc99_sscanf.c: New file.
+	* wcsmbs/isoc99_fwscanf.c: New file.
+	* wcsmbs/isoc99_vswscanf.c: New file.
+	* wcsmbs/isoc99_swscanf.c: New file.
+	* wcsmbs/isoc99_wscanf.c: New file.
+	* wcsmbs/isoc99_vwscanf.c: New file.
+	* wcsmbs/isoc99_vfwscanf.c: New file.
+	* libio/libio.h (_IO_FLAGS2_SCANF_STD): Define.
+	* libio/libioP.h (_IO_acquire_lock_clear_flags2_fct): Also
+	clear _IO_FLAGS2_SCANF_STD bit from _flags2.
+	* stdio-common/vfscanf.c (_IO_vfscanf_internal): Don't
+	handle %as, %aS and %a[ if _IO_FLAGS2_SCANF_STD is set in _flags2.
+	* stdio-common/scanf14.c: New test.
+	* stdio-common/scanf15.c: New test.
+	* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add
+	isoc99_scanf, isoc99_fscanf, isoc99_sscanf,
+	isoc99_vscanf, isoc99_vfscanf, isoc99_vsscanf,
+	isoc99_wscanf, isoc99_fwscanf, isoc99_swscanf,
+	isoc99_vwscanf, isoc99_vfwscanf and isoc99_vswscanf.
+	* sysdeps/ieee754/ldbl-opt/Versions (libc): Export
+	__nldbl___isoc99_scanf@@GLIBC_2.7,
+	__nldbl___isoc99_fscanf@@GLIBC_2.7,
+	__nldbl___isoc99_sscanf@@GLIBC_2.7,
+	__nldbl___isoc99_vscanf@@GLIBC_2.7,
+	__nldbl___isoc99_vfscanf@@GLIBC_2.7,
+	__nldbl___isoc99_vsscanf@@GLIBC_2.7,
+	__nldbl___isoc99_wscanf@@GLIBC_2.7,
+	__nldbl___isoc99_fwscanf@@GLIBC_2.7,
+	__nldbl___isoc99_swscanf@@GLIBC_2.7,
+	__nldbl___isoc99_vwscanf@@GLIBC_2.7,
+	__nldbl___isoc99_vfwscanf@@GLIBC_2.7
+	and __nldbl___isoc99_vswscanf@@GLIBC_2.7.
+	* sysdeps/ieee754/ldbl-opt/nldbl-compat.h (__isoc99_scanf,
+	__isoc99_fscanf, __isoc99_sscanf, __isoc99_vscanf,
+	__isoc99_vfscanf, __isoc99_vsscanf, __isoc99_wscanf,
+	__isoc99_fwscanf, __isoc99_swscanf, __isoc99_vwscanf,
+	__isoc99_vfwscanf, __isoc99_vswscanf): Add NLDBL_DECL.
+	* sysdeps/ieee754/ldbl-opt/nldbl-compat.c
+	(__nldbl___isoc99_scanf, __nldbl___isoc99_fscanf,
+	__nldbl___isoc99_sscanf, __nldbl___isoc99_vscanf,
+	__nldbl___isoc99_vfscanf, __nldbl___isoc99_vsscanf,
+	__nldbl___isoc99_wscanf, __nldbl___isoc99_fwscanf,
+	__nldbl___isoc99_swscanf, __nldbl___isoc99_vwscanf,
+	__nldbl___isoc99_vfwscanf, __nldbl___isoc99_vswscanf): New
+	functions.
+	* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vfscanf.c: New file.
+	* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_swscanf.c: New file.
+	* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vwscanf.c: New file.
+	* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_wscanf.c: New file.
+	* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_scanf.c: New file.
+	* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_sscanf.c: New file.
+	* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vsscanf.c: New file.
+	* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_fwscanf.c: New file.
+	* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vfwscanf.c: New file.
+	* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vswscanf.c: New file.
+	* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vscanf.c: New file.
+	* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_fscanf.c: New file.
+
+	* stdio-common/Makefile (tests): Add scanf13.
+	(scanf13-ENV): New.
+	* stdio-common/vfscanf.c (_IO_vfscanf_internal): Handle
+	m modifier followed by l.
+	(STRING_ARG): Add width argument.
+	(_IO_vfscanf_internal) <case L_('c')>: Handle %mc.
+	<case L_('C')>: Handle %mlc and %mC.
+	<case L_('s'), case L_('S'), case L_('[')>: Adjust STRING_ARG
+	arguments.
+	* stdio-common/scanf13.c: New test.
+
+	* libio/libioP.h (_IO_acquire_lock_clear_flags2_fct): Clear
+	the _IO_FLAGS2_FORTIFY bit from _flags2 rather than _flags.
+
+2007-09-18  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/i386/bits/fcntl.h: Correct return value
+	type and __THROW marker of splice, vmsplice, and tee.
+	* sysdeps/unix/sysv/linux/ia64/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/s390/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/sh/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/bits/fcntl.h: Likewise.
+	* sysdeps/unix/sysv/linux/syscalls.list: Mark splice, vmsplice, and tee
+	as cancellation points.
+
 2003-11-01  Daniel Jacobowitz  <dan@xxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/dl-osinfo.h (_dl_discover_osversion): Don't

Modified: fsf/trunk/libc/elf/dl-lookup.c
==============================================================================
--- fsf/trunk/libc/elf/dl-lookup.c (original)
+++ fsf/trunk/libc/elf/dl-lookup.c Wed Sep 19 00:03:42 2007
@@ -86,36 +86,42 @@
 /* Add extra dependency on MAP to UNDEF_MAP.  */
 static int
 internal_function
-add_dependency (struct link_map *undef_map, struct link_map *map)
+add_dependency (struct link_map *undef_map, struct link_map *map, int flags)
 {
   struct link_map **list;
   struct link_map *runp;
   unsigned int act;
   unsigned int i;
   int result = 0;
+  unsigned long long int serial;
 
   /* Avoid self-references and references to objects which cannot be
      unloaded anyway.  */
   if (undef_map == map)
     return 0;
 
+  /* Save serial number of the target MAP.  */
+  serial = map->l_serial;
+
   /* Make sure nobody can unload the object while we are at it.  */
-  __rtld_lock_lock_recursive (GL(dl_load_lock));
-
-  /* Avoid references to objects which cannot be unloaded anyway.  */
-  if (map->l_type != lt_loaded
-      || (map->l_flags_1 & DF_1_NODELETE) != 0)
-    goto out;
-
-  /* If the object with the undefined reference cannot be removed ever
-     just make sure the same is true for the object which contains the
-     definition.  */
-  if (undef_map->l_type != lt_loaded
-      || (undef_map->l_flags_1 & DF_1_NODELETE) != 0)
-    {
-      map->l_flags_1 |= DF_1_NODELETE;
-      goto out;
-    }
+  if (__builtin_expect (flags & DL_LOOKUP_GSCOPE_LOCK, 0))
+    {
+      /* We can't just call __rtld_lock_lock_recursive (GL(dl_load_lock))
+	 here, that can result in ABBA deadlock.  */
+      THREAD_GSCOPE_RESET_FLAG ();
+      __rtld_lock_lock_recursive (GL(dl_load_lock));
+      THREAD_GSCOPE_SET_FLAG ();
+      /* While MAP value won't change, after THREAD_GSCOPE_RESET_FLAG ()
+	 it can e.g. point to unallocated memory.  So avoid the optimizer
+	 treating the above read from MAP->l_serial as ensurance it
+	 can safely dereference it.  */
+      map = atomic_forced_read (map);
+    }
+  else
+    __rtld_lock_lock_recursive (GL(dl_load_lock));
+
+  /* From this point on it is unsafe to dereference MAP, until it
+     has been found in one of the lists.  */
 
   /* Determine whether UNDEF_MAP already has a reference to MAP.  First
      look in the normal dependencies.  */
@@ -125,7 +131,7 @@
 
       for (i = 0; list[i] != NULL; ++i)
 	if (list[i] == map)
-	  goto out;
+	  goto out_check;
     }
 
   /* No normal dependency.  See whether we already had to add it
@@ -135,7 +141,7 @@
 
   for (i = 0; i < act; ++i)
     if (list[i] == map)
-      goto out;
+      goto out_check;
 
   /* The object is not yet in the dependency list.  Before we add
      it make sure just one more time the object we are about to
@@ -148,7 +154,29 @@
 
   if (runp != NULL)
     {
-      /* The object is still available.  Add the reference now.  */
+      /* The object is still available.  */
+
+      /* MAP could have been dlclosed, freed and then some other dlopened
+	 library could have the same link_map pointer.  */
+      if (map->l_serial != serial)
+	goto out_check;
+
+      /* Avoid references to objects which cannot be unloaded anyway.  */
+      if (map->l_type != lt_loaded
+	  || (map->l_flags_1 & DF_1_NODELETE) != 0)
+	goto out;
+
+      /* If the object with the undefined reference cannot be removed ever
+	 just make sure the same is true for the object which contains the
+	 definition.  */
+      if (undef_map->l_type != lt_loaded
+	  || (undef_map->l_flags_1 & DF_1_NODELETE) != 0)
+	{
+	  map->l_flags_1 |= DF_1_NODELETE;
+	  goto out;
+	}
+
+      /* Add the reference now.  */
       if (__builtin_expect (act >= undef_map->l_reldepsmax, 0))
 	{
 	  /* Allocate more memory for the dependency list.  Since this
@@ -196,6 +224,11 @@
   __rtld_lock_unlock_recursive (GL(dl_load_lock));
 
   return result;
+
+ out_check:
+  if (map->l_serial != serial)
+    result = -1;
+  goto out;
 }
 
 static void
@@ -227,9 +260,11 @@
 
   bump_num_relocations ();
 
-  /* No other flag than DL_LOOKUP_ADD_DEPENDENCY is allowed if we look
-     up a versioned symbol.  */
-  assert (version == NULL || (flags & ~(DL_LOOKUP_ADD_DEPENDENCY)) == 0);
+  /* No other flag than DL_LOOKUP_ADD_DEPENDENCY or DL_LOOKUP_GSCOPE_LOCK
+     is allowed if we look up a versioned symbol.  */
+  assert (version == NULL
+	  || (flags & ~(DL_LOOKUP_ADD_DEPENDENCY | DL_LOOKUP_GSCOPE_LOCK))
+	     == 0);
 
   size_t i = 0;
   if (__builtin_expect (skip_map != NULL, 0))
@@ -335,10 +370,12 @@
 	 runtime lookups.  */
       && (flags & DL_LOOKUP_ADD_DEPENDENCY) != 0
       /* Add UNDEF_MAP to the dependencies.  */
-      && add_dependency (undef_map, current_value.m) < 0)
+      && add_dependency (undef_map, current_value.m, flags) < 0)
       /* Something went wrong.  Perhaps the object we tried to reference
 	 was just removed.  Try finding another definition.  */
-      return _dl_lookup_symbol_x (undef_name, undef_map, ref, symbol_scope,
+      return _dl_lookup_symbol_x (undef_name, undef_map, ref,
+				  (flags & DL_LOOKUP_GSCOPE_LOCK)
+				  ? undef_map->l_scope : symbol_scope,
 				  version, type_class, flags, skip_map);
 
   /* The object is used.  */

Modified: fsf/trunk/libc/elf/dl-object.c
==============================================================================
--- fsf/trunk/libc/elf/dl-object.c (original)
+++ fsf/trunk/libc/elf/dl-object.c Wed Sep 19 00:03:42 2007
@@ -103,6 +103,7 @@
   else
     GL(dl_ns)[nsid]._ns_loaded = new;
   ++GL(dl_ns)[nsid]._ns_nloaded;
+  new->l_serial = GL(dl_load_adds);
   ++GL(dl_load_adds);
 
   /* If we have no loader the new object acts as it.  */

Modified: fsf/trunk/libc/elf/dl-runtime.c
==============================================================================
--- fsf/trunk/libc/elf/dl-runtime.c (original)
+++ fsf/trunk/libc/elf/dl-runtime.c Wed Sep 19 00:03:42 2007
@@ -100,7 +100,10 @@
 	 we are not using any threads (yet).  */
       int flags = DL_LOOKUP_ADD_DEPENDENCY;
       if (!RTLD_SINGLE_THREAD_P)
-	THREAD_GSCOPE_SET_FLAG ();
+	{
+	  THREAD_GSCOPE_SET_FLAG ();
+	  flags |= DL_LOOKUP_GSCOPE_LOCK;
+	}
 
       result = _dl_lookup_symbol_x (strtab + sym->st_name, l, &sym, l->l_scope,
 				    version, ELF_RTYPE_CLASS_PLT, flags, NULL);
@@ -192,7 +195,10 @@
 	     we are not using any threads (yet).  */
 	  int flags = DL_LOOKUP_ADD_DEPENDENCY;
 	  if (!RTLD_SINGLE_THREAD_P)
-	    THREAD_GSCOPE_SET_FLAG ();
+	    {
+	      THREAD_GSCOPE_SET_FLAG ();
+	      flags |= DL_LOOKUP_GSCOPE_LOCK;
+	    }
 
 	  result = _dl_lookup_symbol_x (strtab + refsym->st_name, l,
 					&defsym, l->l_scope, version,

Modified: fsf/trunk/libc/elf/dl-sym.c
==============================================================================
--- fsf/trunk/libc/elf/dl-sym.c (original)
+++ fsf/trunk/libc/elf/dl-sym.c Wed Sep 19 00:03:42 2007
@@ -123,7 +123,8 @@
 	  args.name = name;
 	  args.map = match;
 	  args.vers = vers;
-	  args.flags = flags | DL_LOOKUP_ADD_DEPENDENCY;
+	  args.flags
+	    = flags | DL_LOOKUP_ADD_DEPENDENCY | DL_LOOKUP_GSCOPE_LOCK;
 	  args.refp = &ref;
 
 	  THREAD_GSCOPE_SET_FLAG ();

Modified: fsf/trunk/libc/include/link.h
==============================================================================
--- fsf/trunk/libc/include/link.h (original)
+++ fsf/trunk/libc/include/link.h Wed Sep 19 00:03:42 2007
@@ -286,6 +286,8 @@
     ElfW(Addr) l_relro_addr;
     size_t l_relro_size;
 
+    unsigned long long int l_serial;
+
     /* Audit information.  This array apparent must be the last in the
        structure.  Never add something after it.  */
     struct auditstate

Modified: fsf/trunk/libc/include/stdio.h
==============================================================================
--- fsf/trunk/libc/include/stdio.h (original)
+++ fsf/trunk/libc/include/stdio.h Wed Sep 19 00:03:42 2007
@@ -42,6 +42,22 @@
 extern char *__fgets_unlocked_chk (char *buf, size_t size, int n, FILE *fp);
 extern char *__fgets_chk (char *buf, size_t size, int n, FILE *fp);
 #endif
+
+extern int __isoc99_fscanf (FILE *__restrict __stream,
+			    __const char *__restrict __format, ...) __wur;
+extern int __isoc99_scanf (__const char *__restrict __format, ...) __wur;
+extern int __isoc99_sscanf (__const char *__restrict __s,
+			    __const char *__restrict __format, ...) __THROW;
+extern int __isoc99_vfscanf (FILE *__restrict __s,
+			     __const char *__restrict __format,
+			     _G_va_list __arg) __wur;
+extern int __isoc99_vscanf (__const char *__restrict __format,
+			    _G_va_list __arg) __wur;
+extern int __isoc99_vsscanf (__const char *__restrict __s,
+			     __const char *__restrict __format,
+			     _G_va_list __arg) __THROW;
+libc_hidden_proto (__isoc99_vsscanf)
+libc_hidden_proto (__isoc99_vfscanf)
 
 /* Prototypes for compatibility functions.  */
 extern FILE *__new_tmpfile (void);

Modified: fsf/trunk/libc/include/wchar.h
==============================================================================
--- fsf/trunk/libc/include/wchar.h (original)
+++ fsf/trunk/libc/include/wchar.h Wed Sep 19 00:03:42 2007
@@ -166,6 +166,23 @@
 libc_hidden_proto (__vswprintf_chk)
 #endif
 
+extern int __isoc99_fwscanf (__FILE *__restrict __stream,
+			     __const wchar_t *__restrict __format, ...);
+extern int __isoc99_wscanf (__const wchar_t *__restrict __format, ...);
+extern int __isoc99_swscanf (__const wchar_t *__restrict __s,
+			     __const wchar_t *__restrict __format, ...)
+     __THROW;
+extern int __isoc99_vfwscanf (__FILE *__restrict __s,
+			      __const wchar_t *__restrict __format,
+			      __gnuc_va_list __arg);
+extern int __isoc99_vwscanf (__const wchar_t *__restrict __format,
+			     __gnuc_va_list __arg);
+extern int __isoc99_vswscanf (__const wchar_t *__restrict __s,
+			      __const wchar_t *__restrict __format,
+			      __gnuc_va_list __arg) __THROW;
+libc_hidden_proto (__isoc99_vswscanf)
+libc_hidden_proto (__isoc99_vfwscanf)
+
 /* Internal functions.  */
 extern size_t __mbsrtowcs_l (wchar_t *dst, const char **src, size_t len,
 			     mbstate_t *ps, __locale_t l) attribute_hidden;

Modified: fsf/trunk/libc/inet/tst-network.c
==============================================================================
--- fsf/trunk/libc/inet/tst-network.c (original)
+++ fsf/trunk/libc/inet/tst-network.c Wed Sep 19 00:03:42 2007
@@ -34,7 +34,10 @@
   {"1.0", 0x100},
   {"1", 0x1},
   {"192.168.0.0", 0xC0A80000},
+  {"0", 0},
+  {"0x0", 0},
   /* Now some invalid addresses.  */
+  {"0x", INADDR_NONE},
   {"141.30.225.2800", INADDR_NONE},
   {"141.76.1.1.1", INADDR_NONE},
   {"141.76.1.11.", INADDR_NONE},

Modified: fsf/trunk/libc/libio/bits/stdio-ldbl.h
==============================================================================
--- fsf/trunk/libc/libio/bits/stdio-ldbl.h (original)
+++ fsf/trunk/libc/libio/bits/stdio-ldbl.h Wed Sep 19 00:03:42 2007
@@ -28,9 +28,17 @@
 __LDBL_REDIR_DECL (vfprintf)
 __LDBL_REDIR_DECL (vprintf)
 __LDBL_REDIR_DECL (vsprintf)
+#if defined __USE_ISOC99 && !defined __USE_GNU \
+    && !defined __REDIRECT \
+    && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
+__LDBL_REDIR1_DECL (fscanf, __nldbl___isoc99_fscanf)
+__LDBL_REDIR1_DECL (scanf, __nldbl___isoc99_scanf)
+__LDBL_REDIR1_DECL (sscanf, __nldbl___isoc99_sscanf)
+#else
 __LDBL_REDIR_DECL (fscanf)
 __LDBL_REDIR_DECL (scanf)
 __LDBL_REDIR_DECL (sscanf)
+#endif
 __END_NAMESPACE_STD
 
 #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
@@ -42,9 +50,16 @@
 
 #ifdef	__USE_ISOC99
 __BEGIN_NAMESPACE_C99
+# if !defined __USE_GNU && !defined __REDIRECT \
+     && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
+__LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf)
+__LDBL_REDIR1_DECL (vscanf, __nldbl___isoc99_vscanf)
+__LDBL_REDIR1_DECL (vsscanf, __nldbl___isoc99_vsscanf)
+# else
 __LDBL_REDIR_DECL (vfscanf)
 __LDBL_REDIR_DECL (vsscanf)
 __LDBL_REDIR_DECL (vscanf)
+# endif
 __END_NAMESPACE_C99
 #endif
 

Modified: fsf/trunk/libc/libio/libio.h
==============================================================================
--- fsf/trunk/libc/libio/libio.h (original)
+++ fsf/trunk/libc/libio/libio.h Wed Sep 19 00:03:42 2007
@@ -143,6 +143,9 @@
 # define _IO_FLAGS2_FORTIFY 4
 #endif
 #define _IO_FLAGS2_USER_WBUF 8
+#ifdef _LIBC
+# define _IO_FLAGS2_SCANF_STD 16
+#endif
 
 /* These are "formatting flags" matching the iostream fmtflags enum values. */
 #define _IO_SKIPWS 01

Modified: fsf/trunk/libc/libio/libioP.h
==============================================================================
--- fsf/trunk/libc/libio/libioP.h (original)
+++ fsf/trunk/libc/libio/libioP.h Wed Sep 19 00:03:42 2007
@@ -974,7 +974,7 @@
 _IO_acquire_lock_clear_flags2_fct (_IO_FILE **p)
 {
   _IO_FILE *fp = *p;
-  fp->_flags &= ~_IO_FLAGS2_FORTIFY;
+  fp->_flags2 &= ~(_IO_FLAGS2_FORTIFY | _IO_FLAGS2_SCANF_STD);
   if ((fp->_flags & _IO_USER_LOCK) == 0)
     _IO_funlockfile (fp);
 }

Modified: fsf/trunk/libc/libio/stdio.h
==============================================================================
--- fsf/trunk/libc/libio/stdio.h (original)
+++ fsf/trunk/libc/libio/stdio.h Wed Sep 19 00:03:42 2007
@@ -410,6 +410,34 @@
 /* Read formatted input from S.  */
 extern int sscanf (__const char *__restrict __s,
 		   __const char *__restrict __format, ...) __THROW;
+
+#if defined __USE_ISOC99 && !defined __USE_GNU \
+    && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
+    && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
+# ifdef __REDIRECT
+/* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[
+   GNU extension which conflicts with valid %a followed by letter
+   s, S or [.  */
+extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
+				__const char *__restrict __format, ...),
+		       __isoc99_fscanf) __wur;
+extern int __REDIRECT (scanf, (__const char *__restrict __format, ...),
+		       __isoc99_scanf) __wur;
+extern int __REDIRECT (sscanf, (__const char *__restrict __s,
+				__const char *__restrict __format, ...),
+		       __isoc99_sscanf) __THROW;
+# else
+extern int __isoc99_fscanf (FILE *__restrict __stream,
+			    __const char *__restrict __format, ...) __wur;
+extern int __isoc99_scanf (__const char *__restrict __format, ...) __wur;
+extern int __isoc99_sscanf (__const char *__restrict __s,
+			    __const char *__restrict __format, ...) __THROW;
+#  define fscanf __isoc99_fscanf
+#  define scanf __isoc99_scanf
+#  define sscanf __isoc99_sscanf
+# endif
+#endif
+
 __END_NAMESPACE_STD
 
 #ifdef	__USE_ISOC99
@@ -433,6 +461,42 @@
 extern int vsscanf (__const char *__restrict __s,
 		    __const char *__restrict __format, _G_va_list __arg)
      __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
+
+# if !defined __USE_GNU \
+     && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
+     && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
+#  ifdef __REDIRECT
+/* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[
+   GNU extension which conflicts with valid %a followed by letter
+   s, S or [.  */
+extern int __REDIRECT (vfscanf,
+		       (FILE *__restrict __s,
+			__const char *__restrict __format, _G_va_list __arg),
+		       __isoc99_vfscanf)
+     __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+extern int __REDIRECT (vscanf, (__const char *__restrict __format,
+				_G_va_list __arg), __isoc99_vfscanf)
+     __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
+extern int __REDIRECT (vsscanf,
+		       (__const char *__restrict __s,
+			__const char *__restrict __format, _G_va_list __arg),
+		       __isoc99_vsscanf)
+     __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
+#  else
+extern int __isoc99_vfscanf (FILE *__restrict __s,
+			     __const char *__restrict __format,
+			     _G_va_list __arg) __wur;
+extern int __isoc99_vscanf (__const char *__restrict __format,
+			    _G_va_list __arg) __wur;
+extern int __isoc99_vsscanf (__const char *__restrict __s,
+			     __const char *__restrict __format,
+			     _G_va_list __arg) __THROW;
+#   define vfscanf __isoc99_vfscanf
+#   define vscanf __isoc99_vsscanf
+#   define vsscanf __isoc99_vsscanf
+#  endif
+# endif
+
 __END_NAMESPACE_C99
 #endif /* Use ISO C9x.  */
 

Modified: fsf/trunk/libc/locale/programs/charmap-dir.c
==============================================================================
--- fsf/trunk/libc/locale/programs/charmap-dir.c (original)
+++ fsf/trunk/libc/locale/programs/charmap-dir.c Wed Sep 19 00:03:42 2007
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2002, 2003, 2005, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software; you can redistribute it and/or modify
@@ -264,8 +265,8 @@
       char *alias = NULL;
       char junk[BUFSIZ];
 
-      if (fscanf (stream, " <code_set_name> %as", &alias) == 1
-          || fscanf (stream, "%% alias %as", &alias) == 1)
+      if (fscanf (stream, " <code_set_name> %ms", &alias) == 1
+          || fscanf (stream, "%% alias %ms", &alias) == 1)
         {
           aliases = (char **) xrealloc (aliases,
                                         (naliases + 2) * sizeof (char *));

Modified: fsf/trunk/libc/misc/bits/syslog.h
==============================================================================
--- fsf/trunk/libc/misc/bits/syslog.h (original)
+++ fsf/trunk/libc/misc/bits/syslog.h Wed Sep 19 00:03:42 2007
@@ -27,9 +27,9 @@
 
 #ifdef __va_arg_pack
 __extern_always_inline void
-syslog (int __pri, int __flag, __const char *__fmt, ...)
+syslog (int __pri, __const char *__fmt, ...)
 {
-  return __syslog_chk (__pri, __flag, __fmt, __va_arg_pack ());
+  return __syslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
 }
 #elif !defined __cplusplus
 # define syslog(pri, ...) \

Modified: fsf/trunk/libc/stdio-common/Makefile
==============================================================================
--- fsf/trunk/libc/stdio-common/Makefile (original)
+++ fsf/trunk/libc/stdio-common/Makefile Wed Sep 19 00:03:42 2007
@@ -34,7 +34,9 @@
 	tmpfile tmpfile64 tmpnam tmpnam_r tempnam tempname		      \
 	getline getw putw						      \
 	remove rename renameat						      \
-	flockfile ftrylockfile funlockfile
+	flockfile ftrylockfile funlockfile				      \
+	isoc99_scanf isoc99_vscanf isoc99_fscanf isoc99_vfscanf isoc99_sscanf \
+	isoc99_vsscanf
 
 install-others = $(inst_includedir)/bits/stdio_lim.h
 
@@ -55,7 +57,7 @@
 	 tst-perror tst-sprintf tst-rndseek tst-fdopen tst-fphex bug14 bug15 \
 	 tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
 	 tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \
-	 bug19 bug19a tst-popen2
+	 bug19 bug19a tst-popen2 scanf13 scanf14 scanf15
 
 test-srcs = tst-unbputc tst-printf
 
@@ -91,14 +93,34 @@
 CFLAGS-psignal.c = -fexceptions
 CFLAGS-vprintf.c = -fexceptions
 CFLAGS-cuserid.c = -fexceptions
+
+CFLAGS-vfprintf.c += $(exceptions)
+CFLAGS-fprintf.c += $(exceptions)
+CFLAGS-printf.c += $(exceptions)
+CFLAGS-vfwprintf.c += $(exceptions)
+CFLAGS-vfscanf.c += $(exceptions)
+CFLAGS-vfwscanf.c += $(exceptions)
+CFLAGS-fscanf.c += $(exceptions)
+CFLAGS-scanf.c += $(exceptions)
+CFLAGS-isoc99_vfscanf.c += $(exceptions)
+CFLAGS-isoc99_vscanf.c += $(exceptions)
+CFLAGS-isoc99_fscanf.c += $(exceptions)
+CFLAGS-isoc99_scanf.c += $(exceptions)
 CFLAGS-errlist.c = $(fno-unit-at-a-time)
 CFLAGS-siglist.c = $(fno-unit-at-a-time)
+
+# The following is a hack since we must compile scanf15.c without any
+# GNU extension.  The latter are needed, though, when internal headers
+# are used.  So made sure we see the installed headers first.
+CFLAGS-scanf15.c = -I../libio -I../stdlib -I../wcsmbs -I../time -I../string \
+		   -I../wctype
 
 # We know the test has a format string problem.
 CFLAGS-tst-sprintf.c = -Wno-format
 tst-sscanf-ENV = LOCPATH=$(common-objpfx)localedata
 tst-swprintf-ENV = LOCPATH=$(common-objpfx)localedata
 test-vfprintf-ENV = LOCPATH=$(common-objpfx)localedata
+scanf13-ENV = LOCPATH=$(common-objpfx)localedata
 bug14-ENV = LOCPATH=$(common-objpfx)localedata
 bug15-ENV = LOCPATH=$(common-objpfx)localedata
 

Modified: fsf/trunk/libc/stdio-common/Versions
==============================================================================
--- fsf/trunk/libc/stdio-common/Versions (original)
+++ fsf/trunk/libc/stdio-common/Versions Wed Sep 19 00:03:42 2007
@@ -49,6 +49,10 @@
   GLIBC_2.4 {
     renameat;
   }
+  GLIBC_2.7 {
+    __isoc99_scanf; __isoc99_vscanf; __isoc99_fscanf; __isoc99_vfscanf;
+    __isoc99_sscanf; __isoc99_vsscanf;
+  }
   GLIBC_PRIVATE {
     # global variables
     _itoa_lower_digits;

Added: fsf/trunk/libc/stdio-common/isoc99_fscanf.c
==============================================================================
--- fsf/trunk/libc/stdio-common/isoc99_fscanf.c (added)
+++ fsf/trunk/libc/stdio-common/isoc99_fscanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,40 @@
+/* Copyright (C) 1991, 1997, 2006, 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <libioP.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+/* Read formatted input from STREAM according to the format string FORMAT.  */
+/* VARARGS2 */
+int
+__isoc99_fscanf (FILE *stream, const char *format, ...)
+{
+  va_list arg;
+  int done;
+
+  _IO_acquire_lock_clear_flags2 (stream);
+  stream->_flags2 |= _IO_FLAGS2_SCANF_STD;
+
+  va_start (arg, format);
+  done = INTUSE(_IO_vfscanf) (stream, format, arg, NULL);
+  va_end (arg);
+
+  _IO_release_lock (stream);
+  return done;
+}

Added: fsf/trunk/libc/stdio-common/isoc99_scanf.c
==============================================================================
--- fsf/trunk/libc/stdio-common/isoc99_scanf.c (added)
+++ fsf/trunk/libc/stdio-common/isoc99_scanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,42 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002, 2004, 2006, 2007
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <libioP.h>
+
+
+/* Read formatted input from stdin according to the format string FORMAT.  */
+/* VARARGS1 */
+int
+__isoc99_scanf (const char *format, ...)
+{
+  va_list arg;
+  int done;
+
+  _IO_acquire_lock_clear_flags2 (stdin);
+  stdin->_flags2 |= _IO_FLAGS2_SCANF_STD;
+
+  va_start (arg, format);
+  done = INTUSE(_IO_vfscanf) (stdin, format, arg, NULL);
+  va_end (arg);
+
+  _IO_release_lock (stdin);
+  return done;
+}

Added: fsf/trunk/libc/stdio-common/isoc99_sscanf.c
==============================================================================
--- fsf/trunk/libc/stdio-common/isoc99_sscanf.c (added)
+++ fsf/trunk/libc/stdio-common/isoc99_sscanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,37 @@
+/* Copyright (C) 1991, 1995, 1996, 1998, 2002, 2003, 2004, 2006, 2007
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <libioP.h>
+
+/* Read formatted input from S, according to the format string FORMAT.  */
+/* VARARGS2 */
+int
+__isoc99_sscanf (const char *s, const char *format, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, format);
+  done = __isoc99_vsscanf (s, format, arg);
+  va_end (arg);
+
+  return done;
+}

Added: fsf/trunk/libc/stdio-common/isoc99_vfscanf.c
==============================================================================
--- fsf/trunk/libc/stdio-common/isoc99_vfscanf.c (added)
+++ fsf/trunk/libc/stdio-common/isoc99_vfscanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,35 @@
+/* Copyright (C) 1991, 1997, 2006, 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <libioP.h>
+#include <stdio.h>
+
+/* Read formatted input from STREAM according to the format string FORMAT.  */
+/* VARARGS2 */
+int
+__isoc99_vfscanf (FILE *stream, const char *format, _IO_va_list args)
+{
+  int done;
+
+  _IO_acquire_lock_clear_flags2 (stream);
+  stream->_flags2 |= _IO_FLAGS2_SCANF_STD;
+  done = INTUSE(_IO_vfscanf) (stream, format, args, NULL);
+  _IO_release_lock (stream);
+  return done;
+}
+libc_hidden_def (__isoc99_vfscanf)

Added: fsf/trunk/libc/stdio-common/isoc99_vscanf.c
==============================================================================
--- fsf/trunk/libc/stdio-common/isoc99_vscanf.c (added)
+++ fsf/trunk/libc/stdio-common/isoc99_vscanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,34 @@
+/* Copyright (C) 1991, 1997, 2006, 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <libioP.h>
+#include <stdio.h>
+
+/* Read formatted input from STDIN according to the format string FORMAT.  */
+/* VARARGS2 */
+int
+__isoc99_vscanf (const char *format, _IO_va_list args)
+{
+  int done;
+
+  _IO_acquire_lock_clear_flags2 (stdin);
+  stdin->_flags2 |= _IO_FLAGS2_SCANF_STD;
+  done = INTUSE(_IO_vfscanf) (stdin, format, args, NULL);
+  _IO_release_lock (stdin);
+  return done;
+}

Added: fsf/trunk/libc/stdio-common/isoc99_vsscanf.c
==============================================================================
--- fsf/trunk/libc/stdio-common/isoc99_vsscanf.c (added)
+++ fsf/trunk/libc/stdio-common/isoc99_vsscanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,47 @@
+/* Copyright (C) 1993, 1997-2003, 2006, 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.
+
+   As a special exception, if you link the code in this file with
+   files compiled with a GNU compiler to produce an executable,
+   that does not cause the resulting executable to be covered by
+   the GNU Lesser General Public License.  This exception does not
+   however invalidate any other reasons why the executable file
+   might be covered by the GNU Lesser General Public License.
+   This exception applies to code released by its copyright holders
+   in files containing the exception.  */
+
+#include <libioP.h>
+#include <stdio.h>
+#include "../libio/strfile.h"
+
+int
+__isoc99_vsscanf (const char *string, const char *format, _IO_va_list args)
+{
+  int ret;
+  _IO_strfile sf;
+#ifdef _IO_MTSAFE_IO
+  sf._sbf._f._lock = NULL;
+#endif
+  _IO_no_init (&sf._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
+  _IO_JUMPS ((struct _IO_FILE_plus *) &sf._sbf) = &_IO_str_jumps;
+  _IO_str_init_static_internal (&sf, (char*)string, 0, NULL);
+  sf._sbf._f._flags2 |= _IO_FLAGS2_SCANF_STD;
+  ret = INTUSE(_IO_vfscanf) ((_IO_FILE *) &sf._sbf, format, args, NULL);
+  return ret;
+}
+libc_hidden_def (__isoc99_vsscanf)

Added: fsf/trunk/libc/stdio-common/scanf13.c
==============================================================================
--- fsf/trunk/libc/stdio-common/scanf13.c (added)
+++ fsf/trunk/libc/stdio-common/scanf13.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,187 @@
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+int
+main (void)
+{
+  char *sp1, *sp2, *sp3, *sp4;
+  wchar_t *lsp1, *lsp2, *lsp3, *lsp4;
+  int result = 0;
+  char buf[2048+64];
+  wchar_t wbuf[2048+64];
+  size_t i;
+
+#define FAIL() \
+  do {							\
+    result = 1;						\
+    printf ("test at line %d failed\n", __LINE__);	\
+  } while (0)
+
+  setlocale (LC_ALL, "de_DE.UTF-8");
+  if (sscanf ("A  \xc3\x84-\t\t\xc3\x84-abcdefbcd\t\xc3\x84-B",
+	      "A%ms%10ms%4m[bcd]%4mcB", &sp1, &sp2, &sp3, &sp4) != 4)
+    FAIL ();
+  else
+    {
+      if (strcmp (sp1, "\xc3\x84-") != 0)
+	FAIL ();
+      free (sp1);
+      if (strcmp (sp2, "\xc3\x84-abcdefb") != 0)
+	FAIL ();
+      free (sp2);
+      if (strcmp (sp3, "cd") != 0)
+	FAIL ();
+      free (sp3);
+      if (memcmp (sp4, "\t\xc3\x84-", 4) != 0)
+	FAIL ();
+      free (sp4);
+    }
+
+  if (sscanf ("A  \xc3\x84-\t\t\xc3\x84-abcdefbcd\t\xc3\x84-BB",
+	      "A%mS%10mls%4ml[bcd]%4mCB", &lsp1, &lsp2, &lsp3, &lsp4) != 4)
+    FAIL ();
+  else
+    {
+      if (wcscmp (lsp1, L"\xc4-") != 0)
+	FAIL ();
+      free (lsp1);
+      if (wcscmp (lsp2, L"\xc4-abcdefbc") != 0)
+	FAIL ();
+      free (lsp2);
+      if (wcscmp (lsp3, L"d") != 0)
+	FAIL ();
+      free (lsp3);
+      if (memcmp (lsp4, L"\t\xc4-B", 4 * sizeof (wchar_t)) != 0)
+	FAIL ();
+      free (lsp4);
+    }
+
+  memset (buf, '/', sizeof (buf));
+  buf[0] = '\t';
+  buf[1] = ' ';
+  buf[2] = 0xc3;
+  buf[3] = 0x84;
+  buf[2048] = 0xc3;
+  buf[2049] = 0x84;
+  buf[2058] = '\t';
+  buf[2059] = 'a';
+  if (sscanf (buf, "%ms%mc", &sp1, &sp2) != 2)
+    FAIL ();
+  else
+    {
+      if (sp1[0] != '\xc3' || sp1[1] != '\x84'
+	  || sp1[2046] != '\xc3' || sp1[2047] != '\x84'
+	  || sp1[2056] != '\0')
+	FAIL ();
+      sp1[2046] = '/';
+      sp1[2047] = '/';
+      for (i = 2; i < 2056; i++)
+	if (sp1[i] != '/')
+	  FAIL ();
+      free (sp1);
+      if (sp2[0] != '\t')
+	FAIL ();
+      free (sp2);
+    }
+  if (sscanf (buf, "%2048ms%mc", &sp3, &sp4) != 2)
+    FAIL ();
+  else
+    {
+      if (sp3[0] != '\xc3' || sp3[1] != '\x84'
+	  || sp3[2046] != '\xc3' || sp3[2047] != '\x84'
+	  || sp3[2048] != '\0')
+	FAIL ();
+      for (i = 2; i < 2046; i++)
+	if (sp3[i] != '/')
+	  FAIL ();
+      free (sp3);
+      if (sp4[0] != '/')
+	FAIL ();
+      free (sp4);
+    }
+  if (sscanf (buf, "%4mc%1500m[dr/]%548m[abc/d]%3mc", &sp1, &sp2, &sp3, &sp4)
+      != 4)
+    FAIL ();
+  else
+    {
+      if (memcmp (sp1, "\t \xc3\x84", 4) != 0)
+	FAIL ();
+      free (sp1);
+      for (i = 0; i < 1500; i++)
+	if (sp2[i] != '/')
+	  FAIL ();
+      if (sp2[1500] != '\0')
+	FAIL ();
+      free (sp2);
+      for (i = 0; i < 544; i++)
+	if (sp3[i] != '/')
+	  FAIL ();
+      if (sp3[544] != '\0')
+	FAIL ();
+      free (sp3);
+      if (memcmp (sp4, "\xc3\x84/", 3) != 0)
+	FAIL ();
+      free (sp4);
+    }
+  if (sscanf (buf, "%mS%mC", &lsp1, &lsp2) != 2)
+    FAIL ();
+  else
+    {
+      if (lsp1[0] != L'\xc4' || lsp1[2045] != L'\xc4'
+	  || lsp1[2054] != L'\0')
+	FAIL ();
+      lsp1[2045] = L'/';
+      for (i = 1; i < 2054; i++)
+	if (lsp1[i] != L'/')
+	  FAIL ();
+      free (lsp1);
+      if (lsp2[0] != L'\t')
+	FAIL ();
+      free (lsp2);
+    }
+  if (sscanf (buf, "%2048mls%mlc", &lsp3, &lsp4) != 2)
+    FAIL ();
+  else
+    {
+      if (lsp3[0] != L'\xc4' || lsp3[2045] != L'\xc4'
+	  || lsp3[2048] != L'\0')
+	FAIL ();
+      lsp3[2045] = L'/';
+      for (i = 1; i < 2048; i++)
+	if (lsp3[i] != L'/')
+	  FAIL ();
+      free (lsp3);
+      if (lsp4[0] != L'/')
+	FAIL ();
+      free (lsp4);
+    }
+  if (sscanf (buf, "%4mC%1500ml[dr/]%548ml[abc/d]%3mlc",
+	      &lsp1, &lsp2, &lsp3, &lsp4) != 4)
+    FAIL ();
+  else
+    {
+      if (memcmp (lsp1, L"\t \xc4/", 4 * sizeof (wchar_t)) != 0)
+	FAIL ();
+      free (lsp1);
+      for (i = 0; i < 1500; i++)
+	if (lsp2[i] != L'/')
+	  FAIL ();
+      if (lsp2[1500] != L'\0')
+	FAIL ();
+      free (lsp2);
+      for (i = 0; i < 543; i++)
+	if (lsp3[i] != L'/')
+	  FAIL ();
+      if (lsp3[543] != L'\0')
+	FAIL ();
+      free (lsp3);
+      if (memcmp (lsp4, L"\xc4//", 3 * sizeof (wchar_t)) != 0)
+	FAIL ();
+      free (lsp4);
+    }
+
+  return result;
+}

Added: fsf/trunk/libc/stdio-common/scanf14.c
==============================================================================
--- fsf/trunk/libc/stdio-common/scanf14.c (added)
+++ fsf/trunk/libc/stdio-common/scanf14.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,63 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#define FAIL() \
+  do {							\
+    result = 1;						\
+    printf ("test at line %d failed\n", __LINE__);	\
+  } while (0)
+
+int
+main (void)
+{
+  wchar_t *lsp;
+  char *sp;
+  float f;
+  double d;
+  char c[8];
+  int result = 0;
+
+  if (sscanf (" 0.25s x", "%e%3c", &f, c) != 2)
+    FAIL ();
+  else if (f != 0.25 || memcmp (c, "s x", 3) != 0)
+    FAIL ();
+  if (sscanf (" 1.25s x", "%as%2c", &sp, c) != 2)
+    FAIL ();
+  else
+    {
+      if (strcmp (sp, "1.25s") != 0 || memcmp (c, " x", 2) != 0)
+	FAIL ();
+      memset (sp, 'x', sizeof "1.25s");
+      free (sp);
+    }
+  if (sscanf (" 2.25s x", "%las%2c", &d, c) != 2)
+    FAIL ();
+  else if (d != 2.25 || memcmp (c, " x", 2) != 0)
+    FAIL ();
+  if (sscanf (" 3.25S x", "%4aS%3c", &lsp, c) != 2)
+    FAIL ();
+  else
+    {
+      if (wcscmp (lsp, L"3.25") != 0 || memcmp (c, "S x", 3) != 0)
+	FAIL ();
+      memset (lsp, 'x', sizeof L"3.25");
+      free (lsp);
+    }
+  if (sscanf ("4.25[0-9.] x", "%a[0-9.]%8c", &sp, c) != 2)
+    FAIL ();
+  else
+    {
+      if (strcmp (sp, "4.25") != 0 || memcmp (c, "[0-9.] x", 8) != 0)
+	FAIL ();
+      memset (sp, 'x', sizeof "4.25");
+      free (sp);
+    }
+  if (sscanf ("5.25[0-9.] x", "%la[0-9.]%2c", &d, c) != 2)
+    FAIL ();
+  else if (d != 5.25 || memcmp (c, " x", 2) != 0)
+    FAIL ();
+
+  return result;
+}

Added: fsf/trunk/libc/stdio-common/scanf15.c
==============================================================================
--- fsf/trunk/libc/stdio-common/scanf15.c (added)
+++ fsf/trunk/libc/stdio-common/scanf15.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,54 @@
+#undef _GNU_SOURCE
+#define _XOPEN_SOURCE 600
+/* The following macro definitions are a hack.  They word around disabling
+   the GNU extension while still using a few internal headers.  */
+#define u_char unsigned char
+#define u_short unsigned short
+#define u_int unsigned int
+#define u_long unsigned long
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#define FAIL() \
+  do {							\
+    result = 1;						\
+    printf ("test at line %d failed\n", __LINE__);	\
+  } while (0)
+
+int
+main (void)
+{
+  float f;
+  double d;
+  char c[8];
+  int result = 0;
+
+  if (sscanf (" 0.25s x", "%e%3c", &f, c) != 2)
+    FAIL ();
+  else if (f != 0.25 || memcmp (c, "s x", 3) != 0)
+    FAIL ();
+  if (sscanf (" 1.25s x", "%as%2c", &f, c) != 2)
+    FAIL ();
+  else if (f != 1.25 || memcmp (c, " x", 2) != 0)
+    FAIL ();
+  if (sscanf (" 2.25s x", "%las%2c", &d, c) != 2)
+    FAIL ();
+  else if (d != 2.25 || memcmp (c, " x", 2) != 0)
+    FAIL ();
+  if (sscanf (" 3.25S x", "%4aS%2c", &f, c) != 2)
+    FAIL ();
+  else if (f != 3.25 || memcmp (c, " x", 2) != 0)
+    FAIL ();
+  if (sscanf (" 4.25[0-9.] x", "%a[0-9.]%2c", &f, c) != 2)
+    FAIL ();
+  else if (f != 4.25 || memcmp (c, " x", 2) != 0)
+    FAIL ();
+  if (sscanf (" 5.25[0-9.] x", "%la[0-9.]%2c", &d, c) != 2)
+    FAIL ();
+  else if (d != 5.25 || memcmp (c, " x", 2) != 0)
+    FAIL ();
+
+  return result;
+}

Modified: fsf/trunk/libc/stdio-common/vfscanf.c
==============================================================================
--- fsf/trunk/libc/stdio-common/vfscanf.c (original)
+++ fsf/trunk/libc/stdio-common/vfscanf.c Wed Sep 19 00:03:42 2007
@@ -514,13 +514,25 @@
 	      --f;
 	      break;
 	    }
+	  /* In __isoc99_*scanf %as, %aS and %a[ extension is not
+	     supported at all.  */
+	  if (s->_flags2 & _IO_FLAGS2_SCANF_STD)
+	    {
+	      --f;
+	      break;
+	    }
 	  /* String conversions (%s, %[) take a `char **'
 	     arg and fill it in with a malloc'd pointer.  */
 	  flags |= GNU_MALLOC;
 	  break;
-        case L_('m'):
-          flags |= POSIX_MALLOC;
-          break;
+	case L_('m'):
+	  flags |= POSIX_MALLOC;
+	  if (*f == L_('l'))
+	    {
+	      ++f;
+	      flags |= LONG;
+	    }
+	  break;
 	case L_('z'):
 	  if (need_longlong && sizeof (size_t) > sizeof (unsigned long int))
 	    flags |= LONGDBL;
@@ -635,133 +647,10 @@
 	case L_('c'):	/* Match characters.  */
 	  if ((flags & LONG) == 0)
 	    {
-	      if (!(flags & SUPPRESS))
-		{
-		  str = ARG (char *);
-		  if (str == NULL)
-		    conv_error ();
-		}
-
-	      c = inchar ();
-	      if (__builtin_expect (c == EOF, 0))
-		input_error ();
-
 	      if (width == -1)
 		width = 1;
 
-#ifdef COMPILE_WSCANF
-	      /* We have to convert the wide character(s) into multibyte
-		 characters and store the result.  */
-	      memset (&state, '\0', sizeof (state));
-
-	      do
-		{
-		  size_t n;
-
-		  n = __wcrtomb (!(flags & SUPPRESS) ? str : NULL, c, &state);
-		  if (__builtin_expect (n == (size_t) -1, 0))
-		    /* No valid wide character.  */
-		    input_error ();
-
-		  /* Increment the output pointer.  Even if we don't
-		     write anything.  */
-		  str += n;
-		}
-	      while (--width > 0 && inchar () != EOF);
-#else
-	      if (!(flags & SUPPRESS))
-		{
-		  do
-		    *str++ = c;
-		  while (--width > 0 && inchar () != EOF);
-		}
-	      else
-		while (--width > 0 && inchar () != EOF);
-#endif
-
-	      if (!(flags & SUPPRESS))
-		++done;
-
-	      break;
-	    }
-	  /* FALLTHROUGH */
-	case L_('C'):
-	  if (!(flags & SUPPRESS))
-	    {
-	      wstr = ARG (wchar_t *);
-	      if (wstr == NULL)
-		conv_error ();
-	    }
-
-	  c = inchar ();
-	  if (__builtin_expect (c == EOF, 0))
-	    input_error ();
-
-#ifdef COMPILE_WSCANF
-	  /* Just store the incoming wide characters.  */
-	  if (!(flags & SUPPRESS))
-	    {
-	      do
-		*wstr++ = c;
-	      while (--width > 0 && inchar () != EOF);
-	    }
-	  else
-	    while (--width > 0 && inchar () != EOF);
-#else
-	  {
-	    /* We have to convert the multibyte input sequence to wide
-	       characters.  */
-	    char buf[1];
-	    mbstate_t cstate;
-
-	    memset (&cstate, '\0', sizeof (cstate));
-
-	    do
-	      {
-		/* This is what we present the mbrtowc function first.  */
-		buf[0] = c;
-
-		while (1)
-		  {
-		    size_t n;
-
-		    n = __mbrtowc (!(flags & SUPPRESS) ? wstr : NULL,
-				   buf, 1, &cstate);
-
-		    if (n == (size_t) -2)
-		      {
-			/* Possibly correct character, just not enough
-			   input.  */
-			if (__builtin_expect (inchar () == EOF, 0))
-			  encode_error ();
-
-			buf[0] = c;
-			continue;
-		      }
-
-		    if (__builtin_expect (n != 1, 0))
-		      encode_error ();
-
-		    /* We have a match.  */
-		    break;
-		  }
-
-		/* Advance the result pointer.  */
-		++wstr;
-	      }
-	    while (--width > 0 && inchar () != EOF);
-	  }
-#endif
-
-	  if (!(flags & SUPPRESS))
-	    ++done;
-
-	  break;
-
-	case L_('s'):		/* Read a string.  */
-	  if (!(flags & LONG))
-	    {
-#define STRING_ARG(Str, Type)						      \
+#define STRING_ARG(Str, Type, Width)					      \
 	      do if (!(flags & SUPPRESS))				      \
 		{							      \
 		  if (flags & MALLOC)					      \
@@ -775,7 +664,7 @@
 		      if (strptr == NULL)				      \
 			conv_error ();					      \
 		      /* Allocate an initial buffer.  */		      \
-		      strsize = 100;					      \
+		      strsize = Width;					      \
 		      *strptr = (char *) malloc (strsize * sizeof (Type));    \
 		      Str = (Type *) *strptr;				      \
 		      if (Str != NULL)					      \
@@ -788,7 +677,279 @@
 		  if (Str == NULL)					      \
 		    conv_error ();					      \
 		} while (0)
-	      STRING_ARG (str, char);
+#ifdef COMPILE_WSCANF
+	      STRING_ARG (str, char, 100);
+#else
+	      STRING_ARG (str, char, (width > 1024 ? 1024 : width));
+#endif
+
+	      c = inchar ();
+	      if (__builtin_expect (c == EOF, 0))
+		input_error ();
+
+#ifdef COMPILE_WSCANF
+	      /* We have to convert the wide character(s) into multibyte
+		 characters and store the result.  */
+	      memset (&state, '\0', sizeof (state));
+
+	      do
+		{
+		  size_t n;
+
+		  if (!(flags & SUPPRESS) && (flags & POSIX_MALLOC)
+		      && str + MB_CUR_MAX >= *strptr + strsize)
+		    {
+		      /* We have to enlarge the buffer if the `m' flag
+			 was given.  */
+		      size_t strleng = str - *strptr;
+		      char *newstr;
+
+		      newstr = (char *) realloc (*strptr, strsize * 2);
+		      if (newstr == NULL)
+			{
+			  /* Can't allocate that much.  Last-ditch effort.  */
+			  newstr = (char *) realloc (*strptr,
+						     strleng + MB_CUR_MAX);
+			  if (newstr == NULL)
+			    /* c can't have `a' flag, only `m'.  */
+			    goto reteof;
+			  else
+			    {
+			      *strptr = newstr;
+			      str = newstr + strleng;
+			      strsize = strleng + MB_CUR_MAX;
+			    }
+			}
+		      else
+			{
+			  *strptr = newstr;
+			  str = newstr + strleng;
+			  strsize *= 2;
+			}
+		    }
+
+		  n = __wcrtomb (!(flags & SUPPRESS) ? str : NULL, c, &state);
+		  if (__builtin_expect (n == (size_t) -1, 0))
+		    /* No valid wide character.  */
+		    input_error ();
+
+		  /* Increment the output pointer.  Even if we don't
+		     write anything.  */
+		  str += n;
+		}
+	      while (--width > 0 && inchar () != EOF);
+#else
+	      if (!(flags & SUPPRESS))
+		{
+		  do
+		    {
+		      if ((flags & MALLOC)
+			  && (char *) str == *strptr + strsize)
+			{
+			  /* Enlarge the buffer.  */
+			  size_t newsize
+			    = strsize
+			      + (strsize >= width ? width - 1 : strsize);
+
+			  str = (char *) realloc (*strptr, newsize);
+			  if (str == NULL)
+			    {
+			      /* Can't allocate that much.  Last-ditch
+				 effort.  */
+			      str = (char *) realloc (*strptr, strsize + 1);
+			      if (str == NULL)
+				/* c can't have `a' flag, only `m'.  */
+				goto reteof;
+			      else
+				{
+				  *strptr = (char *) str;
+				  str += strsize;
+				  ++strsize;
+				}
+			    }
+			  else
+			    {
+			      *strptr = (char *) str;
+			      str += strsize;
+			      strsize = newsize;
+			    }
+			}
+		      *str++ = c;
+		    }
+		  while (--width > 0 && inchar () != EOF);
+		}
+	      else
+		while (--width > 0 && inchar () != EOF);
+#endif
+
+	      if (!(flags & SUPPRESS))
+		{
+		  if ((flags & MALLOC) && str - *strptr != strsize)
+		    {
+		      char *cp = (char *) realloc (*strptr, str - *strptr);
+		      if (cp != NULL)
+			*strptr = cp;
+		    }
+		  strptr = NULL;
+		  ++done;
+		}
+
+	      break;
+	    }
+	  /* FALLTHROUGH */
+	case L_('C'):
+	  if (width == -1)
+	    width = 1;
+
+	  STRING_ARG (wstr, wchar_t, (width > 1024 ? 1024 : width));
+
+	  c = inchar ();
+	  if (__builtin_expect (c == EOF, 0))
+	    input_error ();
+
+#ifdef COMPILE_WSCANF
+	  /* Just store the incoming wide characters.  */
+	  if (!(flags & SUPPRESS))
+	    {
+	      do
+		{
+		  if ((flags & MALLOC)
+		      && wstr == (wchar_t *) *strptr + strsize)
+		    {
+		      size_t newsize
+			= strsize + (strsize > width ? width - 1 : strsize);
+		      /* Enlarge the buffer.  */
+		      wstr = (wchar_t *) realloc (*strptr,
+						  newsize * sizeof (wchar_t));
+		      if (wstr == NULL)
+			{
+			  /* Can't allocate that much.  Last-ditch effort.  */
+			  wstr = (wchar_t *) realloc (*strptr,
+						      (strsize + 1)
+						      * sizeof (wchar_t));
+			  if (wstr == NULL)
+			    /* C or lc can't have `a' flag, only `m' flag.  */
+			    goto reteof;
+			  else
+			    {
+			      *strptr = (char *) wstr;
+			      wstr += strsize;
+			      ++strsize;
+			    }
+			}
+		      else
+			{
+			  *strptr = (char *) wstr;
+			  wstr += strsize;
+			  strsize = newsize;
+			}
+		    }
+		  *wstr++ = c;
+		}
+	      while (--width > 0 && inchar () != EOF);
+	    }
+	  else
+	    while (--width > 0 && inchar () != EOF);
+#else
+	  {
+	    /* We have to convert the multibyte input sequence to wide
+	       characters.  */
+	    char buf[1];
+	    mbstate_t cstate;
+
+	    memset (&cstate, '\0', sizeof (cstate));
+
+	    do
+	      {
+		/* This is what we present the mbrtowc function first.  */
+		buf[0] = c;
+
+		if (!(flags & SUPPRESS) && (flags & MALLOC)
+		    && wstr == (wchar_t *) *strptr + strsize)
+		  {
+		    size_t newsize
+		      = strsize + (strsize > width ? width - 1 : strsize);
+		    /* Enlarge the buffer.  */
+		    wstr = (wchar_t *) realloc (*strptr,
+						newsize * sizeof (wchar_t));
+		    if (wstr == NULL)
+		      {
+			/* Can't allocate that much.  Last-ditch effort.  */
+			wstr = (wchar_t *) realloc (*strptr,
+						    ((strsize + 1)
+						     * sizeof (wchar_t)));
+			if (wstr == NULL)
+			  /* C or lc can't have `a' flag, only `m' flag.  */
+			  goto reteof;
+			else
+			  {
+			    *strptr = (char *) wstr;
+			    wstr += strsize;
+			    ++strsize;
+			  }
+		      }
+		    else
+		      {
+			*strptr = (char *) wstr;
+			wstr += strsize;
+			strsize = newsize;
+		      }
+		  }
+
+		while (1)
+		  {
+		    size_t n;
+
+		    n = __mbrtowc (!(flags & SUPPRESS) ? wstr : NULL,
+				   buf, 1, &cstate);
+
+		    if (n == (size_t) -2)
+		      {
+			/* Possibly correct character, just not enough
+			   input.  */
+			if (__builtin_expect (inchar () == EOF, 0))
+			  encode_error ();
+
+			buf[0] = c;
+			continue;
+		      }
+
+		    if (__builtin_expect (n != 1, 0))
+		      encode_error ();
+
+		    /* We have a match.  */
+		    break;
+		  }
+
+		/* Advance the result pointer.  */
+		++wstr;
+	      }
+	    while (--width > 0 && inchar () != EOF);
+	  }
+#endif
+
+	  if (!(flags & SUPPRESS))
+	    {
+	      if ((flags & MALLOC) && wstr - (wchar_t *) *strptr != strsize)
+		{
+		  wchar_t *cp = (wchar_t *) realloc (*strptr,
+						     ((wstr
+						       - (wchar_t *) *strptr)
+						      * sizeof (wchar_t)));
+		  if (cp != NULL)
+		    *strptr = (char *) cp;
+		}
+	      strptr = NULL;
+
+	      ++done;
+	    }
+
+	  break;
+
+	case L_('s'):		/* Read a string.  */
+	  if (!(flags & LONG))
+	    {
+	      STRING_ARG (str, char, 100);
 
 	      c = inchar ();
 	      if (__builtin_expect (c == EOF, 0))
@@ -816,8 +977,8 @@
 		    if (!(flags & SUPPRESS) && (flags & MALLOC)
 			&& str + MB_CUR_MAX >= *strptr + strsize)
 		      {
-			/* We have to enlarge the buffer if the `a' flag
-			   was given.  */
+			/* We have to enlarge the buffer if the `a' or `m'
+			   flag was given.  */
 			size_t strleng = str - *strptr;
 			char *newstr;
 
@@ -969,7 +1130,7 @@
 #endif
 
 	    /* Wide character string.  */
-	    STRING_ARG (wstr, wchar_t);
+	    STRING_ARG (wstr, wchar_t, 100);
 
 	    c = inchar ();
 	    if (__builtin_expect (c == EOF,  0))
@@ -1002,7 +1163,7 @@
 			if (wstr == NULL)
 			  {
 			    /* Can't allocate that much.  Last-ditch
-                               effort.  */
+			       effort.  */
 			    wstr = (wchar_t *) realloc (*strptr,
 							(strsize + 1)
 							* sizeof (wchar_t));
@@ -2120,9 +2281,9 @@
 
 	case L_('['):	/* Character class.  */
 	  if (flags & LONG)
-	    STRING_ARG (wstr, wchar_t);
+	    STRING_ARG (wstr, wchar_t, 100);
 	  else
-	    STRING_ARG (str, char);
+	    STRING_ARG (str, char, 100);
 
 	  if (*f == L_('^'))
 	    {

Modified: fsf/trunk/libc/sysdeps/generic/ldsodefs.h
==============================================================================
--- fsf/trunk/libc/sysdeps/generic/ldsodefs.h (original)
+++ fsf/trunk/libc/sysdeps/generic/ldsodefs.h Wed Sep 19 00:03:42 2007
@@ -845,7 +845,9 @@
     DL_LOOKUP_ADD_DEPENDENCY = 1,
     /* Return most recent version instead of default version for
        unversioned lookup.  */
-    DL_LOOKUP_RETURN_NEWEST = 2
+    DL_LOOKUP_RETURN_NEWEST = 2,
+    /* Set if dl_lookup* called with GSCOPE lock held.  */
+    DL_LOOKUP_GSCOPE_LOCK = 4,
   };
 
 /* Lookup versioned symbol.  */

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/Makefile
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/Makefile (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/Makefile Wed Sep 19 00:03:42 2007
@@ -35,7 +35,11 @@
 		 jn yn ilogb remquo lrint lround llrint llround nexttowardf \
 		 nexttoward conj cacos cacosh casin catan catanh ccos ccosh \
 		 casinh cexp clog cproj csin csinh csqrt ctan ctanh cpow \
-		 cabs carg cimag creal clog10
+		 cabs carg cimag creal clog10 \
+		 isoc99_scanf isoc99_fscanf isoc99_sscanf \
+		 isoc99_vscanf isoc99_vfscanf isoc99_vsscanf \
+		 isoc99_wscanf isoc99_fwscanf isoc99_swscanf \
+		 isoc99_vwscanf isoc99_vfwscanf isoc99_vswscanf
 libnldbl-routines = $(libnldbl-calls:%=nldbl-%)
 libnldbl-inhibit-o = $(object-suffixes)
 libnldbl-static-only-routines = $(libnldbl-routines)

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/Versions
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/Versions (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/Versions Wed Sep 19 00:03:42 2007
@@ -65,6 +65,14 @@
     __nldbl___swprintf_chk; __nldbl___vswprintf_chk; __nldbl___fwprintf_chk;
     __nldbl___wprintf_chk; __nldbl___vfwprintf_chk; __nldbl___vwprintf_chk;
   }
+  GLIBC_2.7 {
+    __nldbl___isoc99_scanf; __nldbl___isoc99_fscanf;
+    __nldbl___isoc99_sscanf; __nldbl___isoc99_vscanf;
+    __nldbl___isoc99_vfscanf; __nldbl___isoc99_vsscanf;
+    __nldbl___isoc99_wscanf; __nldbl___isoc99_fwscanf;
+    __nldbl___isoc99_swscanf; __nldbl___isoc99_vwscanf;
+    __nldbl___isoc99_vfwscanf; __nldbl___isoc99_vswscanf;
+  }
 }
 libm {
   NLDBL_VERSION {

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-compat.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-compat.c Wed Sep 19 00:03:42 2007
@@ -1,5 +1,5 @@
 /* *printf* family compatibility routines for IEEE double as long double
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@xxxxxxxxxx>, 2006.
 
@@ -50,6 +50,10 @@
 libc_hidden_proto (__nldbl___vswprintf_chk)
 libc_hidden_proto (__nldbl___vstrfmon)
 libc_hidden_proto (__nldbl___vstrfmon_l)
+libc_hidden_proto (__nldbl___isoc99_vsscanf)
+libc_hidden_proto (__nldbl___isoc99_vfscanf)
+libc_hidden_proto (__nldbl___isoc99_vswscanf)
+libc_hidden_proto (__nldbl___isoc99_vfwscanf)
 
 static void
 __nldbl_cleanup (void *arg)
@@ -780,6 +784,153 @@
 __nldbl_vsyslog (int pri, const char *fmt, va_list ap)
 {
   __nldbl___vsyslog_chk (pri, -1, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl___isoc99_vfscanf (FILE *s, const char *fmt, va_list ap)
+{
+  int res;
+  set_no_long_double ();
+  res = __isoc99_vfscanf (s, fmt, ap);
+  clear_no_long_double ();
+  return res;
+}
+libc_hidden_def (__nldbl___isoc99_vfscanf)
+
+int
+attribute_compat_text_section
+__nldbl___isoc99_sscanf (const char *s, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___isoc99_vsscanf (s, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___isoc99_vsscanf (const char *string, const char *fmt, va_list ap)
+{
+  int res;
+  __no_long_double = 1;
+  res = __isoc99_vsscanf (string, fmt, ap);
+  __no_long_double = 0;
+  return res;
+}
+libc_hidden_def (__nldbl___isoc99_vsscanf)
+
+int
+attribute_compat_text_section
+__nldbl___isoc99_vscanf (const char *fmt, va_list ap)
+{
+  return __nldbl___isoc99_vfscanf (stdin, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl___isoc99_fscanf (FILE *stream, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___isoc99_vfscanf (stream, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___isoc99_scanf (const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___isoc99_vfscanf (stdin, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___isoc99_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
+{
+  int res;
+  set_no_long_double ();
+  res = __isoc99_vfwscanf (s, fmt, ap);
+  clear_no_long_double ();
+  return res;
+}
+libc_hidden_def (__nldbl___isoc99_vfwscanf)
+
+int
+attribute_compat_text_section
+__nldbl___isoc99_swscanf (const wchar_t *s, const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___isoc99_vswscanf (s, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___isoc99_vswscanf (const wchar_t *string, const wchar_t *fmt,
+			   va_list ap)
+{
+  int res;
+  __no_long_double = 1;
+  res = __isoc99_vswscanf (string, fmt, ap);
+  __no_long_double = 0;
+  return res;
+}
+libc_hidden_def (__nldbl___isoc99_vswscanf)
+
+int
+attribute_compat_text_section
+__nldbl___isoc99_vwscanf (const wchar_t *fmt, va_list ap)
+{
+  return __nldbl___isoc99_vfwscanf (stdin, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl___isoc99_fwscanf (FILE *stream, const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___isoc99_vfwscanf (stream, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___isoc99_wscanf (const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___isoc99_vfwscanf (stdin, fmt, arg);
+  va_end (arg);
+
+  return done;
 }
 
 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-compat.h (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-compat.h Wed Sep 19 00:03:42 2007
@@ -1,5 +1,5 @@
 /* Prototypes for compatibility double == long double entry points.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@xxxxxxxxxx>, 2006.
 
@@ -61,6 +61,18 @@
 NLDBL_DECL (qfcvt);
 NLDBL_DECL (qgcvt);
 NLDBL_DECL (__vstrfmon_l);
+NLDBL_DECL (__isoc99_scanf);
+NLDBL_DECL (__isoc99_fscanf);
+NLDBL_DECL (__isoc99_sscanf);
+NLDBL_DECL (__isoc99_vscanf);
+NLDBL_DECL (__isoc99_vfscanf);
+NLDBL_DECL (__isoc99_vsscanf);
+NLDBL_DECL (__isoc99_wscanf);
+NLDBL_DECL (__isoc99_fwscanf);
+NLDBL_DECL (__isoc99_swscanf);
+NLDBL_DECL (__isoc99_vwscanf);
+NLDBL_DECL (__isoc99_vfwscanf);
+NLDBL_DECL (__isoc99_vswscanf);
 
 /* This one does not exist in the normal interface, only
    __nldbl___vstrfmon really exists.  */

Added: fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_fscanf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_fscanf.c (added)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_fscanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__isoc99_fscanf (FILE *stream, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___isoc99_vfscanf (stream, fmt, arg);
+  va_end (arg);
+
+  return done;
+}

Added: fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_fwscanf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_fwscanf.c (added)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_fwscanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__isoc99_fwscanf (FILE *stream, const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___isoc99_vfwscanf (stream, fmt, arg);
+  va_end (arg);
+
+  return done;
+}

Added: fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_scanf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_scanf.c (added)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_scanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__isoc99_scanf (const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___isoc99_vfscanf (stdin, fmt, arg);
+  va_end (arg);
+
+  return done;
+}

Added: fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_sscanf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_sscanf.c (added)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_sscanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__isoc99_sscanf (const char *s, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___isoc99_vsscanf (s, fmt, arg);
+  va_end (arg);
+
+  return done;
+}

Added: fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_swscanf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_swscanf.c (added)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_swscanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__isoc99_swscanf (const wchar_t *s, const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___isoc99_vswscanf (s, fmt, arg);
+  va_end (arg);
+
+  return done;
+}

Added: fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vfscanf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vfscanf.c (added)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vfscanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__isoc99_vfscanf (FILE *s, const char *fmt, va_list ap)
+{
+  return __nldbl___isoc99_vfscanf (s, fmt, ap);
+}

Added: fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vfwscanf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vfwscanf.c (added)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vfwscanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__isoc99_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
+{
+  return __nldbl___isoc99_vfwscanf (s, fmt, ap);
+}

Added: fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vscanf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vscanf.c (added)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vscanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__isoc99_vscanf (const char *fmt, va_list ap)
+{
+  return __nldbl___isoc99_vfscanf (stdin, fmt, ap);
+}

Added: fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vsscanf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vsscanf.c (added)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vsscanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__isoc99_vsscanf (const char *string, const char *fmt, va_list ap)
+{
+  return __nldbl___isoc99_vsscanf (string, fmt, ap);
+}

Added: fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vswscanf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vswscanf.c (added)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vswscanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__isoc99_vswscanf (const wchar_t *string, const wchar_t *fmt, va_list ap)
+{
+  return __nldbl___isoc99_vswscanf (string, fmt, ap);
+}

Added: fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vwscanf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vwscanf.c (added)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vwscanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__isoc99_vwscanf (const wchar_t *fmt, va_list ap)
+{
+  return __nldbl___isoc99_vfwscanf (stdin, fmt, ap);
+}

Added: fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_wscanf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_wscanf.c (added)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-opt/nldbl-isoc99_wscanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__isoc99_wscanf (const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___isoc99_vfwscanf (stdin, fmt, arg);
+  va_end (arg);
+
+  return done;
+}

Modified: fsf/trunk/libc/sysdeps/sparc/sparc32/elf/start.S
==============================================================================
--- fsf/trunk/libc/sysdeps/sparc/sparc32/elf/start.S (original)
+++ fsf/trunk/libc/sysdeps/sparc/sparc32/elf/start.S Wed Sep 19 00:03:42 2007
@@ -1,5 +1,5 @@
 /* Startup code for elf32-sparc
-   Copyright (C) 1997, 1998, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2002, 2004, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson <richard@xxxxxxxxxxxxxx>, 1997.
 
@@ -48,8 +48,6 @@
 	.global _start
 	.type _start,#function
 _start:
-	cfi_startproc
-
 #ifdef SHARED
 	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7
 	call	.LLGETPC0
@@ -60,7 +58,6 @@
      drop their arguments.  */
 	mov	%g0, %fp
 	sub	%sp, 6*4, %sp
-	cfi_adjust_cfa_offset(6*4)
 
   /* Extract the arguments and environment as encoded on the stack.  The
      argument info starts after one register window (16 words) past the SP.  */
@@ -93,8 +90,6 @@
   /* Die very horribly if exit returns.  */
 	unimp
 
-	cfi_endproc
-
 	.size _start, .-_start
 
 /* Define a symbol for the first piece of initialized data.  */

Modified: fsf/trunk/libc/sysdeps/sparc/sparc64/elf/start.S
==============================================================================
--- fsf/trunk/libc/sysdeps/sparc/sparc64/elf/start.S (original)
+++ fsf/trunk/libc/sysdeps/sparc/sparc64/elf/start.S Wed Sep 19 00:03:42 2007
@@ -1,5 +1,5 @@
 /* Startup code for elf64-sparc
-   Copyright (C) 1997, 1998, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2002, 2004, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson <richard@xxxxxxxxxxxxxx>, 1997.
 
@@ -48,8 +48,6 @@
 	.global _start
 	.type _start,#function
 _start:
-	cfi_startproc
-
 #ifdef SHARED
 	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7
 	call	.LLGETPC0
@@ -60,7 +58,6 @@
      drop their arguments.  */
 	mov	%g0, %fp
 	sub	%sp, 6*8, %sp
-	cfi_adjust_cfa_offset(6*8)
 
   /* Extract the arguments and environment as encoded on the stack.  The
      argument info starts after one register window (16 words) past the SP,
@@ -94,8 +91,6 @@
   /* Die very horribly if exit returns.  */
 	illtrap	0
 
-	cfi_endproc
-
 	.size _start, .-_start
 
 /* Define a symbol for the first piece of initialized data.  */

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h Wed Sep 19 00:03:42 2007
@@ -213,17 +213,17 @@
 
 
 /* Splice address range into a pipe.  */
-extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
-		     unsigned int __flags);
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+			 size_t __count, unsigned int __flags);
 
 /* Splice two files together.  */
-extern int splice (int __fdin, __off64_t *__offin, int __fdout,
-		   __off64_t *__offout, size_t __len, unsigned int __flags)
-    __THROW;
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+		       __off64_t *__offout, size_t __len,
+		       unsigned int __flags);
 
 /* In-kernel implementation of tee for pipe buffers.  */
-extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
-    __THROW;
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+		    unsigned int __flags);
 
 #endif
 

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/bits/fcntl.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/bits/fcntl.h Wed Sep 19 00:03:42 2007
@@ -221,17 +221,17 @@
 
 
 /* Splice address range into a pipe.  */
-extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
-		     unsigned int __flags);
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+			 size_t __count, unsigned int __flags);
 
 /* Splice two files together.  */
-extern int splice (int __fdin, __off64_t *__offin, int __fdout,
-		   __off64_t *__offout, size_t __len, unsigned int __flags)
-    __THROW;
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+		       __off64_t *__offout, size_t __len,
+		       unsigned int __flags);
 
 /* In-kernel implementation of tee for pipe buffers.  */
-extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
-    __THROW;
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+		    unsigned int __flags);
 
 #endif
 

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h Wed Sep 19 00:03:42 2007
@@ -215,17 +215,17 @@
 
 
 /* Splice address range into a pipe.  */
-extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
-		     unsigned int __flags);
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+			 size_t __count, unsigned int __flags);
 
 /* Splice two files together.  */
-extern int splice (int __fdin, __off64_t *__offin, int __fdout,
-		   __off64_t *__offout, size_t __len, unsigned int __flags)
-    __THROW;
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+		       __off64_t *__offout, size_t __len,
+		       unsigned int __flags);
 
 /* In-kernel implementation of tee for pipe buffers.  */
-extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
-    __THROW;
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+		    unsigned int __flags);
 
 #endif
 

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h Wed Sep 19 00:03:42 2007
@@ -221,17 +221,17 @@
 
 
 /* Splice address range into a pipe.  */
-extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
-		     unsigned int __flags);
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+			 size_t __count, unsigned int __flags);
 
 /* Splice two files together.  */
-extern int splice (int __fdin, __off64_t *__offin, int __fdout,
-		   __off64_t *__offout, size_t __len, unsigned int __flags)
-    __THROW;
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+		       __off64_t *__offout, size_t __len,
+		       unsigned int __flags);
 
 /* In-kernel implementation of tee for pipe buffers.  */
-extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
-    __THROW;
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+		    unsigned int __flags);
 
 #endif
 

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/bits/fcntl.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/bits/fcntl.h Wed Sep 19 00:03:42 2007
@@ -241,17 +241,17 @@
 
 
 /* Splice address range into a pipe.  */
-extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
-		     unsigned int __flags);
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+			 size_t __count, unsigned int __flags);
 
 /* Splice two files together.  */
-extern int splice (int __fdin, __off64_t *__offin, int __fdout,
-		   __off64_t *__offout, size_t __len, unsigned int __flags)
-    __THROW;
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+		       __off64_t *__offout, size_t __len,
+		       unsigned int __flags);
 
 /* In-kernel implementation of tee for pipe buffers.  */
-extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
-    __THROW;
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+		    unsigned int __flags);
 
 #endif
 

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/sh/bits/fcntl.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/sh/bits/fcntl.h Wed Sep 19 00:03:42 2007
@@ -221,17 +221,17 @@
 
 
 /* Splice address range into a pipe.  */
-extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
-		     unsigned int __flags);
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+			 size_t __count, unsigned int __flags);
 
 /* Splice two files together.  */
-extern int splice (int __fdin, __off64_t *__offin, int __fdout,
-		   __off64_t *__offout, size_t __len, unsigned int __flags)
-    __THROW;
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+		       __off64_t *__offout, size_t __len,
+		       unsigned int __flags);
 
 /* In-kernel implementation of tee for pipe buffers.  */
-extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
-    __THROW;
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+		    unsigned int __flags);
 
 #endif
 

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h Wed Sep 19 00:03:42 2007
@@ -240,17 +240,17 @@
 
 
 /* Splice address range into a pipe.  */
-extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
-		     unsigned int __flags);
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+			 size_t __count, unsigned int __flags);
 
 /* Splice two files together.  */
-extern int splice (int __fdin, __off64_t *__offin, int __fdout,
-		   __off64_t *__offout, size_t __len, unsigned int __flags)
-    __THROW;
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+		       __off64_t *__offout, size_t __len,
+		       unsigned int __flags);
 
 /* In-kernel implementation of tee for pipe buffers.  */
-extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
-    __THROW;
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+		    unsigned int __flags);
 
 #endif
 

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S Wed Sep 19 00:03:42 2007
@@ -82,8 +82,6 @@
 
 	.type	__thread_start,@function
 __thread_start:
-	cfi_startproc
-
 #ifdef RESET_PID
 	sethi	%hi(CLONE_THREAD), %l0
 	andcc	%g4, %l0, %g0
@@ -104,8 +102,6 @@
 	call	HIDDEN_JUMPTARGET(_exit),0
 	 nop
 
-	cfi_endproc
-
 	.size	__thread_start, .-__thread_start
 
 weak_alias (__clone, clone)

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S Wed Sep 19 00:03:42 2007
@@ -78,7 +78,6 @@
 
 	.type __thread_start,@function
 __thread_start:
-	cfi_startproc
 #ifdef RESET_PID
 	sethi	%hi(CLONE_THREAD), %l0
 	andcc	%g4, %l0, %g0
@@ -97,7 +96,6 @@
 	 mov	%g3,%o0
 	call	HIDDEN_JUMPTARGET(_exit),0
 	 nop
-	cfi_endproc
 
 	.size	__thread_start, .-__thread_start
 

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/syscalls.list
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/syscalls.list (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/syscalls.list Wed Sep 19 00:03:42 2007
@@ -66,14 +66,14 @@
 setfsuid	EXTRA	setfsuid	i:i	setfsuid
 setpgid		-	setpgid		i:ii	__setpgid	setpgid
 sigaltstack	-	sigaltstack	i:PP	__sigaltstack	sigaltstack
-splice		EXTRA	splice		i:iPiPii	splice
+splice		EXTRA	splice		Ci:iPiPii	splice
 sysinfo		EXTRA	sysinfo		i:p	sysinfo
 swapon		-	swapon		i:si	__swapon	swapon
 swapoff		-	swapoff		i:s	__swapoff	swapoff
-tee		EXTRA	tee		i:iiii	tee
+tee		EXTRA	tee		Ci:iiii	tee
 unshare		EXTRA	unshare		i:i	unshare
 uselib		EXTRA	uselib		i:s	uselib
-vmsplice	EXTRA	vmsplice	i:iPii	vmsplice
+vmsplice	EXTRA	vmsplice	Ci:iPii	vmsplice
 wait4		-	wait4		i:iWiP	__wait4		wait4
 
 chown		-	chown		i:sii	__libc_chown	__chown chown

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h Wed Sep 19 00:03:42 2007
@@ -235,17 +235,17 @@
 
 
 /* Splice address range into a pipe.  */
-extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
-		     unsigned int __flags);
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+			 size_t __count, unsigned int __flags);
 
 /* Splice two files together.  */
-extern int splice (int __fdin, __off64_t *__offin, int __fdout,
-		   __off64_t *__offout, size_t __len, unsigned int __flags)
-    __THROW;
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+		       __off64_t *__offout, size_t __len,
+		       unsigned int __flags);
 
 /* In-kernel implementation of tee for pipe buffers.  */
-extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
-    __THROW;
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+		    unsigned int __flags);
 
 #endif
 

Modified: fsf/trunk/libc/wcsmbs/Makefile
==============================================================================
--- fsf/trunk/libc/wcsmbs/Makefile (original)
+++ fsf/trunk/libc/wcsmbs/Makefile Wed Sep 19 00:03:42 2007
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2000,2002,2003,2004,2005,2006
+# Copyright (C) 1995-2000,2002,2003,2004,2005,2006,2007
 #	Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
@@ -38,7 +38,9 @@
 	    wcwidth wcswidth \
 	    wcscoll_l wcsxfrm_l \
 	    wcscasecmp wcsncase wcscasecmp_l wcsncase_l \
-	    wcsmbsload mbsrtowcs_l
+	    wcsmbsload mbsrtowcs_l \
+	    isoc99_wscanf isoc99_vwscanf isoc99_fwscanf isoc99_vfwscanf \
+	    isoc99_swscanf isoc99_vswscanf
 
 tests := tst-wcstof wcsmbs-tst1 tst-wcsnlen tst-btowc tst-mbrtowc \
 	 tst-wcrtomb tst-wcpncpy tst-mbsrtowcs tst-wchar-h tst-mbrtowc2
@@ -65,6 +67,14 @@
 CFLAGS-wcstof_l.c = $(strtox-CFLAGS)
 CFLAGS-tst-wchar-h.c = -D_FORTIFY_SOURCE=2
 
+CFLAGS-isoc99_wscanf.c += $(exceptions)
+CFLAGS-isoc99_fwscanf.c += $(exceptions)
+CFLAGS-isoc99_vwscanf.c += $(exceptions)
+CFLAGS-isoc99_vfwscanf.c += $(exceptions)
+ifneq (,$(filter %REENTRANT, $(defines)))
+CPPFLAGS += -D_IO_MTSAFE_IO
+endif
+
 # We need to find the default version of strtold_l in stdlib.
 CPPFLAGS-wcstold_l.c = -I../stdlib
 

Modified: fsf/trunk/libc/wcsmbs/Versions
==============================================================================
--- fsf/trunk/libc/wcsmbs/Versions (original)
+++ fsf/trunk/libc/wcsmbs/Versions Wed Sep 19 00:03:42 2007
@@ -24,4 +24,8 @@
     # w*
     wcschrnul; wmempcpy;
   }
+  GLIBC_2.7 {
+    __isoc99_wscanf; __isoc99_vwscanf; __isoc99_fwscanf; __isoc99_vfwscanf;
+    __isoc99_swscanf; __isoc99_vswscanf;
+  }
 }

Modified: fsf/trunk/libc/wcsmbs/bits/wchar-ldbl.h
==============================================================================
--- fsf/trunk/libc/wcsmbs/bits/wchar-ldbl.h (original)
+++ fsf/trunk/libc/wcsmbs/bits/wchar-ldbl.h Wed Sep 19 00:03:42 2007
@@ -21,7 +21,7 @@
 # error "Never include <bits/wchar-ldbl.h> directly; use <wchar.h> instead."
 #endif
 
-#if defined __USE_ISOC99 || defined __USE_UNIX98
+#if defined __USE_ISOC95 || defined __USE_UNIX98
 __BEGIN_NAMESPACE_C99
 __LDBL_REDIR_DECL (fwprintf);
 __LDBL_REDIR_DECL (wprintf);
@@ -29,18 +29,33 @@
 __LDBL_REDIR_DECL (vfwprintf);
 __LDBL_REDIR_DECL (vwprintf);
 __LDBL_REDIR_DECL (vswprintf);
+# if defined __USE_ISOC99 && !defined __USE_GNU \
+     && !defined __REDIRECT \
+     && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
+__LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf)
+__LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf)  
+__LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf)
+# else
 __LDBL_REDIR_DECL (fwscanf);
 __LDBL_REDIR_DECL (wscanf);
 __LDBL_REDIR_DECL (swscanf);
+# endif
 __END_NAMESPACE_C99
 #endif
 
 #ifdef __USE_ISOC99
 __BEGIN_NAMESPACE_C99
 __LDBL_REDIR1_DECL (wcstold, wcstod);
+# if !defined __USE_GNU && !defined __REDIRECT \
+     && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
+__LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf)
+__LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf)  
+__LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf)
+# else
 __LDBL_REDIR_DECL (vfwscanf);
 __LDBL_REDIR_DECL (vwscanf);
 __LDBL_REDIR_DECL (vswscanf);
+# endif
 __END_NAMESPACE_C99
 #endif
 

Added: fsf/trunk/libc/wcsmbs/isoc99_fwscanf.c
==============================================================================
--- fsf/trunk/libc/wcsmbs/isoc99_fwscanf.c (added)
+++ fsf/trunk/libc/wcsmbs/isoc99_fwscanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,41 @@
+/* Copyright (C) 1991, 1997, 2006, 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <libioP.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <wchar.h>
+
+/* Read formatted input from STREAM according to the format string FORMAT.  */
+/* VARARGS2 */
+int
+__isoc99_fwscanf (FILE *stream, const wchar_t *format, ...)
+{
+  va_list arg;
+  int done;
+
+  _IO_acquire_lock_clear_flags2 (stream);
+  stream->_flags2 |= _IO_FLAGS2_SCANF_STD;
+
+  va_start (arg, format);
+  done = _IO_vfwscanf (stream, format, arg, NULL);
+  va_end (arg);
+
+  _IO_release_lock (stream);
+  return done;
+}

Added: fsf/trunk/libc/wcsmbs/isoc99_swscanf.c
==============================================================================
--- fsf/trunk/libc/wcsmbs/isoc99_swscanf.c (added)
+++ fsf/trunk/libc/wcsmbs/isoc99_swscanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,38 @@
+/* Copyright (C) 1991, 1995, 1996, 1998, 2002, 2003, 2004, 2006, 2007
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <libioP.h>
+#include <wchar.h>
+
+/* Read formatted input from S, according to the format string FORMAT.  */
+/* VARARGS2 */
+int
+__isoc99_swscanf (const wchar_t *s, const wchar_t *format, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, format);
+  done = __isoc99_vswscanf (s, format, arg);
+  va_end (arg);
+
+  return done;
+}

Added: fsf/trunk/libc/wcsmbs/isoc99_vfwscanf.c
==============================================================================
--- fsf/trunk/libc/wcsmbs/isoc99_vfwscanf.c (added)
+++ fsf/trunk/libc/wcsmbs/isoc99_vfwscanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,36 @@
+/* Copyright (C) 1991, 1997, 2006, 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <libioP.h>
+#include <stdio.h>
+#include <wchar.h>
+
+/* Read formatted input from STREAM according to the format string FORMAT.  */
+/* VARARGS2 */
+int
+__isoc99_vfwscanf (FILE *stream, const wchar_t *format, _IO_va_list args)
+{
+  int done;
+
+  _IO_acquire_lock_clear_flags2 (stream);
+  stream->_flags2 |= _IO_FLAGS2_SCANF_STD;
+  done = _IO_vfwscanf (stream, format, args, NULL);
+  _IO_release_lock (stream);
+  return done;
+}
+libc_hidden_def (__isoc99_vfwscanf)

Added: fsf/trunk/libc/wcsmbs/isoc99_vswscanf.c
==============================================================================
--- fsf/trunk/libc/wcsmbs/isoc99_vswscanf.c (added)
+++ fsf/trunk/libc/wcsmbs/isoc99_vswscanf.c Wed Sep 19 00:03:42 2007
@@ -1,0 +1,49 @@
+/* Copyright (C) 1993, 1997-2003, 2006, 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free

[... 211 lines stripped ...]