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

[commits] r3584 - in /fsf/trunk/libc: ./ iconv/ iconvdata/ localedata/ localedata/charmaps/ localedata/locales/ posix/ resolv/ string/...



Author: eglibc
Date: Mon Sep 24 00:03:30 2007
New Revision: 3584

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

Added:
    fsf/trunk/libc/iconvdata/mac-centraleurope.c
    fsf/trunk/libc/localedata/charmaps/MAC-CENTRALEUROPE
    fsf/trunk/libc/wcsmbs/wcsatcliff.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/iconv/iconv_open.c
    fsf/trunk/libc/iconvdata/Makefile
    fsf/trunk/libc/iconvdata/TESTS
    fsf/trunk/libc/iconvdata/gconv-modules
    fsf/trunk/libc/iconvdata/tst-tables.sh
    fsf/trunk/libc/localedata/ChangeLog
    fsf/trunk/libc/localedata/locales/de_CH
    fsf/trunk/libc/posix/regcomp.c
    fsf/trunk/libc/resolv/ns_print.c
    fsf/trunk/libc/string/stratcliff.c
    fsf/trunk/libc/wcsmbs/Makefile
    fsf/trunk/libc/wcsmbs/wcsnlen.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Mon Sep 24 00:03:30 2007
@@ -1,3 +1,32 @@
+2007-09-13  Aurelien Jarno  <aurelien@xxxxxxxxxxx>
+
+	[BZ #5028]
+	* posix/regcomp.c (lookup_collation_sequence_value): check that
+	nrules != 0 for multibyte chars.
+
+2007-09-23  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* resolv/ns_print.c (ns_sprintrrf): Handle ns_t_a6 and ns_t_opt.
+	Provide better error message in case the type is unknown.
+
+	[BZ #4963]
+	* wcsmbs/wcsnlen.c: Don't reference before checking the length.
+	* string/stratcliff.c: Make usable to test wide char functions.
+	* wcsmbs/wcsatcliff.c: New file.
+	* wcsmbs/Makefiel (tests): Add wcsatcliff.
+
+	[BZ #4972]
+	* iconvdata/Makefile (modules): Add MAC-CENTRALEUROPE.
+	(distribute): Add mac-centraleurope.c.
+	(gen-8bit-gap-modules): Add mac-centraleurope.
+	* iconvdata/mac-centraleurope.c: New file.
+	* iconvdata/gconv-modules: Add entries for MAC-CENTRALEUROPE.
+	* iconvdata/TESTS: Likewise.
+	* iconvdata/tst-tables.sh: Likewise.
+
+	[BZ #5043]
+	* iconv/iconv_open.c (iconv_open): For large codeset names use malloc.
+
 2007-09-21  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* sysdeps/x86_64/cacheinfo.c (__x86_64_data_cache_size_half): Renamed

Modified: fsf/trunk/libc/iconv/iconv_open.c
==============================================================================
--- fsf/trunk/libc/iconv/iconv_open.c (original)
+++ fsf/trunk/libc/iconv/iconv_open.c Mon Sep 24 00:03:30 2007
@@ -18,8 +18,10 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <alloca.h>
 #include <errno.h>
 #include <iconv.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -30,28 +32,49 @@
 iconv_t
 iconv_open (const char *tocode, const char *fromcode)
 {
-  char *tocode_conv;
-  char *fromcode_conv;
-  size_t tocode_len;
-  size_t fromcode_len;
-  __gconv_t cd;
-  int res;
-
   /* Normalize the name.  We remove all characters beside alpha-numeric,
      '_', '-', '/', '.', and ':'.  */
-  tocode_len = strlen (tocode);
-  tocode_conv = (char *) alloca (tocode_len + 3);
+  size_t tocode_len = strlen (tocode) + 3;
+  char *tocode_conv;
+  bool tocode_usealloca = __libc_use_alloca (tocode_len);
+  if (tocode_usealloca)
+    tocode_conv = (char *) alloca (tocode_len);
+  else
+    {
+      tocode_conv = (char *) malloc (tocode_len);
+      if (tocode_conv == NULL)
+	return (iconv_t) -1;
+    }
   strip (tocode_conv, tocode);
   tocode = (tocode_conv[2] == '\0' && tocode[0] != '\0'
 	    ? upstr (tocode_conv, tocode) : tocode_conv);
 
-  fromcode_len = strlen (fromcode);
-  fromcode_conv = (char *) alloca (fromcode_len + 3);
+  size_t fromcode_len = strlen (fromcode) + 3;
+  char *fromcode_conv;
+  bool fromcode_usealloca = __libc_use_alloca (fromcode_len);
+  if (fromcode_usealloca)
+    fromcode_conv = (char *) alloca (fromcode_len);
+  else
+    {
+      fromcode_conv = (char *) malloc (fromcode_len);
+      if (fromcode_conv == NULL)
+	{
+	  if (! tocode_usealloca)
+	    free (tocode_conv);
+	  return (iconv_t) -1;
+	}
+    }
   strip (fromcode_conv, fromcode);
   fromcode = (fromcode_conv[2] == '\0' && fromcode[0] != '\0'
 	      ? upstr (fromcode_conv, fromcode) : fromcode_conv);
 
-  res = __gconv_open (tocode, fromcode, &cd, 0);
+  __gconv_t cd;
+  int res = __gconv_open (tocode, fromcode, &cd, 0);
+
+  if (! fromcode_usealloca)
+    free (fromcode_conv);
+  if (! tocode_usealloca)
+    free (tocode_conv);
 
   if (__builtin_expect (res, __GCONV_OK) != __GCONV_OK)
     {
@@ -59,7 +82,7 @@
       if (res == __GCONV_NOCONV || res == __GCONV_NODB)
 	__set_errno (EINVAL);
 
-      return (iconv_t) -1;
+      cd = (iconv_t) -1;
     }
 
   return (iconv_t) cd;

Modified: fsf/trunk/libc/iconvdata/Makefile
==============================================================================
--- fsf/trunk/libc/iconvdata/Makefile (original)
+++ fsf/trunk/libc/iconvdata/Makefile Mon Sep 24 00:03:30 2007
@@ -58,7 +58,8 @@
 	   IBM1142 IBM1143 IBM1144 IBM1145 IBM1146 IBM1147 IBM1148 	 \
 	   IBM1149 IBM1166 IBM1167 IBM4517 IBM4899 IBM4909 IBM4971 	 \
 	   IBM5347 IBM9030 IBM9066 IBM9448 IBM12712 IBM16804             \
-	   IBM1364 IBM1371 IBM1388 IBM1390 IBM1399 ISO_11548-1 MIK BRF
+	   IBM1364 IBM1371 IBM1388 IBM1390 IBM1399 ISO_11548-1 MIK BRF	 \
+	   MAC-CENTRALEUROPE
 
 modules.so := $(addsuffix .so, $(modules))
 
@@ -197,7 +198,7 @@
 	      ibm12712.c ibm12712.h ibm16804.c ibm16804.h                   \
 	      ibm1364.c ibm1364.h ibm1371.c ibm1371.h ibm1388.c ibm1388.h   \
 	      ibm1390.c ibm1390.h ibm1399.c ibm1399.h iso_11548-1.c mik.c   \
-	      brf.c
+	      brf.c mac-centraleurope.c
 
 # We build the transformation modules only when we build shared libs.
 ifeq (yes,$(build-shared))
@@ -238,7 +239,8 @@
 			iso8859-13 iso8859-14 iso8859-15 mac-uk sami-ws2   \
 			iso-ir-197 tis-620 koi8-u ibm874 cp10007 koi8-t	   \
 			georgian-ps georgian-academy iso-ir-209 mac-sami   \
-			iso8859-11 ibm866nav pt154 rk1048 mik brf
+			iso8859-11 ibm866nav pt154 rk1048 mik brf \
+			mac-centraleurope
 
 gen-special-modules := iso8859-7jp
 

Modified: fsf/trunk/libc/iconvdata/TESTS
==============================================================================
--- fsf/trunk/libc/iconvdata/TESTS (original)
+++ fsf/trunk/libc/iconvdata/TESTS Mon Sep 24 00:03:30 2007
@@ -167,3 +167,5 @@
 ISO_11548-1		ISO_11548-1		-	UTF8
 MIK			MIK			Y	UTF8
 BRF			BRF			-	UTF8
+MAC-SAMI		MAC-SAMI		Y	UTF8
+MAC-CENTRALEUROPE	MAC-CENTRALEUROPE	Y	UTF8

Modified: fsf/trunk/libc/iconvdata/gconv-modules
==============================================================================
--- fsf/trunk/libc/iconvdata/gconv-modules (original)
+++ fsf/trunk/libc/iconvdata/gconv-modules Mon Sep 24 00:03:30 2007
@@ -1911,3 +1911,8 @@
 #	from			to			module		cost
 module	BRF//			INTERNAL		BRF		1
 module	INTERNAL		BRF//			BRF		1
+
+#	from			to			module		cost
+alias	CP1282//		MAC-CENTRALEUROPE//
+module	MAC-CENTRALEUROPE//	INTERNAL		MAC-CENTRALEUROPE 1
+module	INTERNAL		MAC-CENTRALEUROPE//	MAC-CENTRALEUROPE 1

Added: fsf/trunk/libc/iconvdata/mac-centraleurope.c
==============================================================================
--- fsf/trunk/libc/iconvdata/mac-centraleurope.c (added)
+++ fsf/trunk/libc/iconvdata/mac-centraleurope.c Mon Sep 24 00:03:30 2007
@@ -1,0 +1,29 @@
+/* Conversion from and to MAC-CENTRALEUROPE.
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2007.
+
+   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 <stdint.h>
+
+/* Get the conversion table.  */
+#define TABLES <mac-centraleurope.h>
+
+#define CHARSET_NAME	"MAC-CENTRALEUROPE//"
+#define HAS_HOLES	0	/* All 256 character are defined.  */
+
+#include <8bit-gap.c>

Modified: fsf/trunk/libc/iconvdata/tst-tables.sh
==============================================================================
--- fsf/trunk/libc/iconvdata/tst-tables.sh (original)
+++ fsf/trunk/libc/iconvdata/tst-tables.sh Mon Sep 24 00:03:30 2007
@@ -209,6 +209,7 @@
   RK1048
   MIK
   BRF
+  MAC-CENTRALEUROPE
   #
   # Multibyte encodings come here
   #

Modified: fsf/trunk/libc/localedata/ChangeLog
==============================================================================
--- fsf/trunk/libc/localedata/ChangeLog (original)
+++ fsf/trunk/libc/localedata/ChangeLog Mon Sep 24 00:03:30 2007
@@ -1,3 +1,11 @@
+2007-09-23  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #4556]
+	* locales/de_CH: Fix d_fmt.
+
+	[BZ #4972]
+	* charmaps/MAC-CENTRALEUROPE: New file.
+
 2007-08-24  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	[BZ #3842]

Added: fsf/trunk/libc/localedata/charmaps/MAC-CENTRALEUROPE
==============================================================================
--- fsf/trunk/libc/localedata/charmaps/MAC-CENTRALEUROPE (added)
+++ fsf/trunk/libc/localedata/charmaps/MAC-CENTRALEUROPE Mon Sep 24 00:03:30 2007
@@ -1,0 +1,261 @@
+<code_set_name> MAC_CENTRALEUROPE
+<comment> %
+<escape_char> /
+
+%alias CP1282
+<U0000>     /x00         NULL
+<U0001>     /x01         START OF HEADING
+<U0002>     /x02         START OF TEXT
+<U0003>     /x03         END OF TEXT
+<U0004>     /x04         END OF TRANSMISSION
+<U0005>     /x05         ENQUIRY
+<U0006>     /x06         ACKNOWLEDGE
+<U0007>     /x07         BELL
+<U0008>     /x08         BACKSPACE
+<U0009>     /x09         HORIZONTAL TABULATION
+<U000A>     /x0a         LINE FEED
+<U000B>     /x0b         VERTICAL TABULATION
+<U000C>     /x0c         FORM FEED
+<U000D>     /x0d         CARRIAGE RETURN
+<U000E>     /x0e         SHIFT OUT
+<U000F>     /x0f         SHIFT IN
+<U0010>     /x10         DATA LINK ESCAPE
+<U0011>     /x11         DEVICE CONTROL ONE
+<U0012>     /x12         DEVICE CONTROL TWO
+<U0013>     /x13         DEVICE CONTROL THREE
+<U0014>     /x14         DEVICE CONTROL FOUR
+<U0015>     /x15         NEGATIVE ACKNOWLEDGE
+<U0016>     /x16         SYNCHRONOUS IDLE
+<U0017>     /x17         END OF TRANSMISSION BLOCK
+<U0018>     /x18         CANCEL
+<U0019>     /x19         END OF MEDIUM
+<U001A>     /x1a         SUBSTITUTE
+<U001B>     /x1b         ESCAPE
+<U001C>     /x1c         FILE SEPARATOR
+<U001D>     /x1d         GROUP SEPARATOR
+<U001E>     /x1e         RECORD SEPARATOR
+<U001F>     /x1f         UNIT SEPARATOR
+<U0020>     /x20         SPACE
+<U0021>     /x21         EXCLAMATION MARK
+<U0022>     /x22         QUOTATION MARK
+<U0023>     /x23         NUMBER SIGN
+<U0024>     /x24         DOLLAR SIGN
+<U0025>     /x25         PERCENT SIGN
+<U0026>     /x26         AMPERSAND
+<U0027>     /x27         APOSTROPHE
+<U0028>     /x28         LEFT PARENTHESIS
+<U0029>     /x29         RIGHT PARENTHESIS
+<U002A>     /x2a         ASTERISK
+<U002B>     /x2b         PLUS SIGN
+<U002C>     /x2c         COMMA
+<U002D>     /x2d         HYPHEN-MINUS
+<U002E>     /x2e         FULL STOP
+<U002F>     /x2f         SOLIDUS
+<U0030>     /x30         DIGIT ZERO
+<U0031>     /x31         DIGIT ONE
+<U0032>     /x32         DIGIT TWO
+<U0033>     /x33         DIGIT THREE
+<U0034>     /x34         DIGIT FOUR
+<U0035>     /x35         DIGIT FIVE
+<U0036>     /x36         DIGIT SIX
+<U0037>     /x37         DIGIT SEVEN
+<U0038>     /x38         DIGIT EIGHT
+<U0039>     /x39         DIGIT NINE
+<U003A>     /x3a         COLON
+<U003B>     /x3b         SEMICOLON
+<U003C>     /x3c         LESS-THAN SIGN
+<U003D>     /x3d         EQUALS SIGN
+<U003E>     /x3e         GREATER-THAN SIGN
+<U003F>     /x3f         QUESTION MARK
+<U0040>     /x40         COMMERCIAL AT
+<U0041>     /x41         LATIN CAPITAL LETTER A
+<U0042>     /x42         LATIN CAPITAL LETTER B
+<U0043>     /x43         LATIN CAPITAL LETTER C
+<U0044>     /x44         LATIN CAPITAL LETTER D
+<U0045>     /x45         LATIN CAPITAL LETTER E
+<U0046>     /x46         LATIN CAPITAL LETTER F
+<U0047>     /x47         LATIN CAPITAL LETTER G
+<U0048>     /x48         LATIN CAPITAL LETTER H
+<U0049>     /x49         LATIN CAPITAL LETTER I
+<U004A>     /x4a         LATIN CAPITAL LETTER J
+<U004B>     /x4b         LATIN CAPITAL LETTER K
+<U004C>     /x4c         LATIN CAPITAL LETTER L
+<U004D>     /x4d         LATIN CAPITAL LETTER M
+<U004E>     /x4e         LATIN CAPITAL LETTER N
+<U004F>     /x4f         LATIN CAPITAL LETTER O
+<U0050>     /x50         LATIN CAPITAL LETTER P
+<U0051>     /x51         LATIN CAPITAL LETTER Q
+<U0052>     /x52         LATIN CAPITAL LETTER R
+<U0053>     /x53         LATIN CAPITAL LETTER S
+<U0054>     /x54         LATIN CAPITAL LETTER T
+<U0055>     /x55         LATIN CAPITAL LETTER U
+<U0056>     /x56         LATIN CAPITAL LETTER V
+<U0057>     /x57         LATIN CAPITAL LETTER W
+<U0058>     /x58         LATIN CAPITAL LETTER X
+<U0059>     /x59         LATIN CAPITAL LETTER Y
+<U005A>     /x5a         LATIN CAPITAL LETTER Z
+<U005B>     /x5b         LEFT SQUARE BRACKET
+<U005C>     /x5c         REVERSE SOLIDUS
+<U005D>     /x5d         RIGHT SQUARE BRACKET
+<U005E>     /x5e         CIRCUMFLEX ACCENT
+<U005F>     /x5f         LOW LINE
+<U0060>     /x60         GRAVE ACCENT
+<U0061>     /x61         LATIN SMALL LETTER A
+<U0062>     /x62         LATIN SMALL LETTER B
+<U0063>     /x63         LATIN SMALL LETTER C
+<U0064>     /x64         LATIN SMALL LETTER D
+<U0065>     /x65         LATIN SMALL LETTER E
+<U0066>     /x66         LATIN SMALL LETTER F
+<U0067>     /x67         LATIN SMALL LETTER G
+<U0068>     /x68         LATIN SMALL LETTER H
+<U0069>     /x69         LATIN SMALL LETTER I
+<U006A>     /x6a         LATIN SMALL LETTER J
+<U006B>     /x6b         LATIN SMALL LETTER K
+<U006C>     /x6c         LATIN SMALL LETTER L
+<U006D>     /x6d         LATIN SMALL LETTER M
+<U006E>     /x6e         LATIN SMALL LETTER N
+<U006F>     /x6f         LATIN SMALL LETTER O
+<U0070>     /x70         LATIN SMALL LETTER P
+<U0071>     /x71         LATIN SMALL LETTER Q
+<U0072>     /x72         LATIN SMALL LETTER R
+<U0073>     /x73         LATIN SMALL LETTER S
+<U0074>     /x74         LATIN SMALL LETTER T
+<U0075>     /x75         LATIN SMALL LETTER U
+<U0076>     /x76         LATIN SMALL LETTER V
+<U0077>     /x77         LATIN SMALL LETTER W
+<U0078>     /x78         LATIN SMALL LETTER X
+<U0079>     /x79         LATIN SMALL LETTER Y
+<U007A>     /x7a         LATIN SMALL LETTER Z
+<U007B>     /x7b         LEFT CURLY BRACKET
+<U007C>     /x7c         VERTICAL LINE
+<U007D>     /x7d         RIGHT CURLY BRACKET
+<U007E>     /x7e         TILDE
+<U007F>     /x7f         DELETE
+<U00C4>     /x80         LATIN CAPITAL LETTER A WITH DIAERESIS
+<U0100>     /x81         LATIN CAPITAL LETTER A WITH MACRON
+<U0101>     /x82         LATIN SMALL LETTER A WITH MACRON
+<U00C9>     /x83         LATIN CAPITAL LETTER E WITH ACUTE
+<U0104>     /x84         LATIN CAPITAL LETTER A WITH OGONEK
+<U00D6>     /x85         LATIN CAPITAL LETTER O WITH DIAERESIS
+<U00DC>     /x86         LATIN CAPITAL LETTER U WITH DIAERESIS
+<U00E1>     /x87         LATIN SMALL LETTER A WITH ACUTE
+<U0105>     /x88         LATIN SMALL LETTER A WITH OGONEK
+<U010C>     /x89         LATIN CAPITAL LETTER C WITH CARON
+<U00E4>     /x8a         LATIN SMALL LETTER A WITH DIAERESIS
+<U010D>     /x8b         LATIN SMALL LETTER C WITH CARON
+<U0106>     /x8c         LATIN CAPITAL LETTER C WITH ACUTE
+<U0107>     /x8d         LATIN SMALL LETTER C WITH ACUTE
+<U00E9>     /x8e         LATIN SMALL LETTER E WITH ACUTE
+<U0179>     /x8f         LATIN CAPITAL LETTER Z WITH ACUTE
+<U017A>     /x90         LATIN SMALL LETTER Z WITH ACUTE
+<U010E>     /x91         LATIN CAPITAL LETTER D WITH CARON
+<U00ED>     /x92         LATIN SMALL LETTER I WITH ACUTE
+<U010F>     /x93         LATIN SMALL LETTER D WITH CARON
+<U0112>     /x94         LATIN CAPITAL LETTER E WITH MACRON
+<U0113>     /x95         LATIN SMALL LETTER E WITH MACRON
+<U0116>     /x96         LATIN CAPITAL LETTER E WITH DOT ABOVE
+<U00F3>     /x97         LATIN SMALL LETTER O WITH ACUTE
+<U0117>     /x98         LATIN SMALL LETTER E WITH DOT ABOVE
+<U00F4>     /x99         LATIN SMALL LETTER O WITH CIRCUMFLEX
+<U00F6>     /x9a         LATIN SMALL LETTER O WITH DIAERESIS
+<U00F5>     /x9b         LATIN SMALL LETTER O WITH TILDE
+<U00FA>     /x9c         LATIN SMALL LETTER U WITH ACUTE
+<U011A>     /x9d         LATIN CAPITAL LETTER E WITH CARON
+<U011B>     /x9e         LATIN SMALL LETTER E WITH CARON
+<U00FC>     /x9f         LATIN SMALL LETTER U WITH DIAERESIS
+<U2020>     /xa0         DAGGER
+<U00B0>     /xa1         DEGREE SIGN
+<U0118>     /xa2         LATIN CAPITAL LETTER E WITH OGONEK
+<U00A3>     /xa3         POUND SIGN
+<U00A7>     /xa4         SECTION SIGN
+<U2022>     /xa5         BULLET
+<U00B6>     /xa6         PILCROW SIGN
+<U00DF>     /xa7         LATIN SMALL LETTER SHARP S
+<U00AE>     /xa8         REGISTERED SIGN
+<U00A9>     /xa9         COPYRIGHT SIGN
+<U2122>     /xaa         TRADE MARK SIGN
+<U0119>     /xab         LATIN SMALL LETTER E WITH OGONEK
+<U00A8>     /xac         DIAERESIS
+<U2260>     /xad         NOT EQUAL TO
+<U0123>     /xae         LATIN SMALL LETTER G WITH CEDILLA
+<U012E>     /xaf         LATIN CAPITAL LETTER I WITH OGONEK
+<U012F>     /xb0         LATIN SMALL LETTER I WITH OGONEK
+<U012A>     /xb1         LATIN CAPITAL LETTER I WITH MACRON
+<U2264>     /xb2         LESS-THAN OR EQUAL TO
+<U2265>     /xb3         GREATER-THAN OR EQUAL TO
+<U012B>     /xb4         LATIN SMALL LETTER I WITH MACRON
+<U0136>     /xb5         LATIN CAPITAL LETTER K WITH CEDILLA
+<U2202>     /xb6         PARTIAL DIFFERENTIAL
+<U2211>     /xb7         N-ARY SUMMATION
+<U0142>     /xb8         LATIN SMALL LETTER L WITH STROKE
+<U013B>     /xb9         LATIN CAPITAL LETTER L WITH CEDILLA
+<U013C>     /xba         LATIN SMALL LETTER L WITH CEDILLA
+<U013D>     /xbb         LATIN CAPITAL LETTER L WITH CARON
+<U013E>     /xbc         LATIN SMALL LETTER L WITH CARON
+<U0139>     /xbd         LATIN CAPITAL LETTER L WITH ACUTE
+<U013A>     /xbe         LATIN SMALL LETTER L WITH ACUTE
+<U0145>     /xbf         LATIN CAPITAL LETTER N WITH CEDILLA
+<U0146>     /xc0         LATIN SMALL LETTER N WITH CEDILLA
+<U0143>     /xc1         LATIN CAPITAL LETTER N WITH ACUTE
+<U00AC>     /xc2         NOT SIGN
+<U221A>     /xc3         SQUARE ROOT
+<U0144>     /xc4         LATIN SMALL LETTER N WITH ACUTE
+<U0147>     /xc5         LATIN CAPITAL LETTER N WITH CARON
+<U2206>     /xc6         INCREMENT
+<U00AB>     /xc7         LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+<U00BB>     /xc8         RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+<U2026>     /xc9         HORIZONTAL ELLIPSIS
+<U00A0>     /xca         NO-BREAK SPACE
+<U0148>     /xcb         LATIN SMALL LETTER N WITH CARON
+<U0150>     /xcc         LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
+<U00D5>     /xcd         LATIN CAPITAL LETTER O WITH TILDE
+<U0151>     /xce         LATIN SMALL LETTER O WITH DOUBLE ACUTE
+<U014C>     /xcf         LATIN CAPITAL LETTER O WITH MACRON
+<U2013>     /xd0         EN DASH
+<U2014>     /xd1         EM DASH
+<U201C>     /xd2         LEFT DOUBLE QUOTATION MARK
+<U201D>     /xd3         RIGHT DOUBLE QUOTATION MARK
+<U2018>     /xd4         LEFT SINGLE QUOTATION MARK
+<U2019>     /xd5         RIGHT SINGLE QUOTATION MARK
+<U00F7>     /xd6         DIVISION SIGN
+<U25CA>     /xd7         LOZENGE
+<U014D>     /xd8         LATIN SMALL LETTER O WITH MACRON
+<U0154>     /xd9         LATIN CAPITAL LETTER R WITH ACUTE
+<U0155>     /xda         LATIN SMALL LETTER R WITH ACUTE
+<U0158>     /xdb         LATIN CAPITAL LETTER R WITH CARON
+<U2039>     /xdc         SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+<U203A>     /xdd         SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+<U0159>     /xde         LATIN SMALL LETTER R WITH CARON
+<U0156>     /xdf         LATIN CAPITAL LETTER R WITH CEDILLA
+<U0157>     /xe0         LATIN SMALL LETTER R WITH CEDILLA
+<U0160>     /xe1         LATIN CAPITAL LETTER S WITH CARON
+<U201A>     /xe2         SINGLE LOW-9 QUOTATION MARK
+<U201E>     /xe3         DOUBLE LOW-9 QUOTATION MARK
+<U0161>     /xe4         LATIN SMALL LETTER S WITH CARON
+<U015A>     /xe5         LATIN CAPITAL LETTER S WITH ACUTE
+<U015B>     /xe6         LATIN SMALL LETTER S WITH ACUTE
+<U00C1>     /xe7         LATIN CAPITAL LETTER A WITH ACUTE
+<U0164>     /xe8         LATIN CAPITAL LETTER T WITH CARON
+<U0165>     /xe9         LATIN SMALL LETTER T WITH CARON
+<U00CD>     /xea         LATIN CAPITAL LETTER I WITH ACUTE
+<U017D>     /xeb         LATIN CAPITAL LETTER Z WITH CARON
+<U017E>     /xec         LATIN SMALL LETTER Z WITH CARON
+<U016A>     /xed         LATIN CAPITAL LETTER U WITH MACRON
+<U00D3>     /xee         LATIN CAPITAL LETTER O WITH ACUTE
+<U00D4>     /xef         LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+<U016B>     /xf0         LATIN SMALL LETTER U WITH MACRON
+<U016E>     /xf1         LATIN CAPITAL LETTER U WITH RING ABOVE
+<U00DA>     /xf2         LATIN CAPITAL LETTER U WITH ACUTE
+<U016F>     /xf3         LATIN SMALL LETTER U WITH RING ABOVE
+<U0170>     /xf4         LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
+<U0171>     /xf5         LATIN SMALL LETTER U WITH DOUBLE ACUTE
+<U0172>     /xf6         LATIN CAPITAL LETTER U WITH OGONEK
+<U0173>     /xf7         LATIN SMALL LETTER U WITH OGONEK
+<U00DD>     /xf8         LATIN CAPITAL LETTER Y WITH ACUTE
+<U00FD>     /xf9         LATIN SMALL LETTER Y WITH ACUTE
+<U0137>     /xfa         LATIN SMALL LETTER K WITH CEDILLA
+<U017B>     /xfb         LATIN CAPITAL LETTER Z WITH DOT ABOVE
+<U0141>     /xfc         LATIN CAPITAL LETTER L WITH STROKE
+<U017C>     /xfd         LATIN SMALL LETTER Z WITH DOT ABOVE
+<U0122>     /xfe         LATIN CAPITAL LETTER G WITH CEDILLA
+<U02C7>     /xff         CARON

Modified: fsf/trunk/libc/localedata/locales/de_CH
==============================================================================
--- fsf/trunk/libc/localedata/locales/de_CH (original)
+++ fsf/trunk/libc/localedata/locales/de_CH Mon Sep 24 00:03:30 2007
@@ -15,7 +15,6 @@
 % Date: 1996-10-15
 % Users: general
 % Repertoiremap: mnemonic.ds
-% Charset: ISO-8859-1
 % Distribution and use is free, also
 % for commercial purposes.
 
@@ -30,7 +29,7 @@
 language   "German"
 territory  "Switzerland"
 revision   "1.0"
-date       "2000-06-29"
+date       "2007-09-23"
 %
 category  "de_CH:2000";LC_IDENTIFICATION
 category  "de_CH:2000";LC_CTYPE
@@ -114,7 +113,7 @@
         "<U004E><U006F><U0076><U0065><U006D><U0062><U0065><U0072>";/
         "<U0044><U0065><U007A><U0065><U006D><U0062><U0065><U0072>"
 d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
-d_fmt   "<U0025><U0059><U002D><U0025><U006D><U002D><U0025><U0064>"
+d_fmt   "<U0025><U0064><U002E><U0025><U006D><U002E><U0025><U0059>"
 t_fmt   "<U0025><U0054>"
 am_pm   "";""
 t_fmt_ampm ""

Modified: fsf/trunk/libc/posix/regcomp.c
==============================================================================
--- fsf/trunk/libc/posix/regcomp.c (original)
+++ fsf/trunk/libc/posix/regcomp.c Mon Sep 24 00:03:30 2007
@@ -2747,7 +2747,7 @@
       return elem;
     }
 
-  /* Local function for parse_bracket_exp used in _LIBC environement.
+  /* Local function for parse_bracket_exp used in _LIBC environment.
      Look up the collation sequence value of BR_ELEM.
      Return the value if succeeded, UINT_MAX otherwise.  */
 
@@ -2771,7 +2771,8 @@
 	}
       else if (br_elem->type == MB_CHAR)
 	{
-	  return __collseq_table_lookup (collseqwc, br_elem->opr.wch);
+	  if (nrules != 0)
+	    return __collseq_table_lookup (collseqwc, br_elem->opr.wch);
 	}
       else if (br_elem->type == COLL_SYM)
 	{

Modified: fsf/trunk/libc/resolv/ns_print.c
==============================================================================
--- fsf/trunk/libc/resolv/ns_print.c (original)
+++ fsf/trunk/libc/resolv/ns_print.c Mon Sep 24 00:03:30 2007
@@ -112,6 +112,7 @@
 
 	const char *comment;
 	char tmp[100];
+	char errbuf[40];
 	int len, x;
 
 	/*
@@ -174,11 +175,11 @@
 		rdata += len;
 		T(addstr(" ", 1, &buf, &buflen));
 
-		    
+
 		/* Second word, optional in ISDN records. */
 		if (type == ns_t_isdn && rdata == edata)
 			break;
-		    
+
 		T(len = charstr(rdata, edata, &buf, &buflen));
 		if (len == 0)
 			goto formerr;
@@ -596,7 +597,7 @@
 			}
 			else
 				leader = " ";
-	
+
 			for (n = 0; n < len; n += 48) {
 				T(addstr(leader, strlen(leader),
 					 &buf, &buflen));
@@ -625,8 +626,48 @@
 		break;
 	    }
 
+	case ns_t_a6: {
+		struct in6_addr a;
+		int pbyte, pbit;
+
+		/* prefix length */
+		if (rdlen == 0U) goto formerr;
+		len = SPRINTF((tmp, "%d ", *rdata));
+		T(addstr(tmp, len, &buf, &buflen));
+		pbit = *rdata;
+		if (pbit > 128) goto formerr;
+		pbyte = (pbit & ~7) / 8;
+		rdata++;
+
+		/* address suffix: provided only when prefix len != 128 */
+		if (pbit < 128) {
+			if (rdata + pbyte >= edata) goto formerr;
+			memset(&a, 0, sizeof(a));
+			memcpy(&a.s6_addr[pbyte], rdata, sizeof(a) - pbyte);
+			(void) inet_ntop(AF_INET6, &a, buf, buflen);
+			addlen(strlen(buf), &buf, &buflen);
+			rdata += sizeof(a) - pbyte;
+		}
+
+		/* prefix name: provided only when prefix len > 0 */
+		if (pbit == 0)
+			break;
+		if (rdata >= edata) goto formerr;
+		T(addstr(" ", 1, &buf, &buflen));
+		T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
+
+		break;
+	    }
+
+	case ns_t_opt: {
+		len = SPRINTF((tmp, "%u bytes", class));
+		T(addstr(tmp, len, &buf, &buflen));
+		break;
+	    }
+
 	default:
-		comment = "unknown RR type";
+		snprintf (errbuf, sizeof (errbuf), "unknown RR type %d", type);
+		comment = errbuf;
 		goto hexify;
 	}
 	return (buf - obuf);

Modified: fsf/trunk/libc/string/stratcliff.c
==============================================================================
--- fsf/trunk/libc/string/stratcliff.c (original)
+++ fsf/trunk/libc/string/stratcliff.c Mon Sep 24 00:03:30 2007
@@ -1,5 +1,5 @@
 /* Test for string function add boundaries of usable memory.
-   Copyright (C) 1996,1997,1999-2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,1999-2002,2003,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -31,20 +31,40 @@
 #include <sys/mman.h>
 #include <sys/param.h>
 
-#ifndef MAX
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#ifndef CHAR
+# define L(c) c
+# define CHAR char
+# define MEMSET memset
+# define STRLEN strlen
+# define STRNLEN strnlen
+# define STRCHR strchr
+# define STRRCHR strrchr
+# define STRCPY strcpy
+# define STRNCPY strncpy
+# define MEMCMP memcmp
+# define STPCPY stpcpy
+# define STPNCPY stpncpy
+# define MEMCPY memcpy
+# define MEMPCPY mempcpy
 #endif
 
-int
-main (int argc, char *argv[])
+
+#define STRINGIFY(s) STRINGIFY2 (s)
+#define STRINGIFY2(s) #s
+
+
+static int
+do_test (void)
 {
   int size = sysconf (_SC_PAGESIZE);
-  char *adr, *dest;
+  int nchars = size / sizeof (CHAR);
+  CHAR *adr;
+  CHAR *dest;
   int result = 0;
 
-  adr = (char *) mmap (NULL, 3 * size, PROT_READ | PROT_WRITE,
+  adr = (CHAR *) mmap (NULL, 3 * size, PROT_READ | PROT_WRITE,
 		       MAP_PRIVATE | MAP_ANON, -1, 0);
-  dest = (char *) mmap (NULL, 3 * size, PROT_READ | PROT_WRITE,
+  dest = (CHAR *) mmap (NULL, 3 * size, PROT_READ | PROT_WRITE,
 			MAP_PRIVATE | MAP_ANON, -1, 0);
   if (adr == MAP_FAILED || dest == MAP_FAILED)
     {
@@ -60,270 +80,310 @@
     {
       int inner, middle, outer;
 
-      mprotect(adr, size, PROT_NONE);
-      mprotect(adr + 2 * size, size, PROT_NONE);
-      adr += size;
-
-      mprotect(dest, size, PROT_NONE);
-      mprotect(dest + 2 * size, size, PROT_NONE);
-      dest += size;
-
-      memset (adr, 'T', size);
-
-      /* strlen test */
-      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
-        {
-          for (inner = MAX (outer, size - 64); inner < size; ++inner)
-	    {
-	      adr[inner] = '\0';
-
-	      if (strlen (&adr[outer]) != (size_t) (inner - outer))
-		{
-		  printf ("strlen flunked for outer = %d, inner = %d\n",
-			  outer, inner);
-		  result = 1;
-		}
-
-	      adr[inner] = 'T';
-	    }
-        }
-
-      /* strchr test */
-      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
-        {
-	  for (middle = MAX (outer, size - 64); middle < size; ++middle)
-	    {
-	      for (inner = middle; inner < size; ++inner)
-		{
-		  char *cp;
-		  adr[middle] = 'V';
-		  adr[inner] = '\0';
-
-		  cp = strchr (&adr[outer], 'V');
+      mprotect (adr, size, PROT_NONE);
+      mprotect (adr + 2 * nchars, size, PROT_NONE);
+      adr += nchars;
+
+      mprotect (dest, size, PROT_NONE);
+      mprotect (dest + 2 * nchars, size, PROT_NONE);
+      dest += nchars;
+
+      MEMSET (adr, L('T'), nchars);
+
+      /* strlen/wcslen test */
+      for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
+        {
+          for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
+	    {
+	      adr[inner] = L('\0');
+
+	      if (STRLEN (&adr[outer]) != (size_t) (inner - outer))
+		{
+		  printf ("%s flunked for outer = %d, inner = %d\n",
+			  STRINGIFY (STRLEN), outer, inner);
+		  result = 1;
+		}
+
+	      adr[inner] = L('T');
+	    }
+        }
+
+      /* strnlen/wcsnlen test */
+      for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
+        {
+          for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
+	    {
+	      adr[inner] = L('\0');
+
+	      if (STRNLEN (&adr[outer], inner - outer + 1)
+		  != (size_t) (inner - outer))
+		{
+		  printf ("%s flunked for outer = %d, inner = %d\n",
+			  STRINGIFY (STRNLEN), outer, inner);
+		  result = 1;
+		}
+
+	      adr[inner] = L('T');
+	    }
+        }
+      for (outer = nchars; outer >= MAX (0, nchars - 128); --outer)
+        {
+          for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
+	    {
+	      if (STRNLEN (&adr[outer], inner - outer + 1)
+		  != (size_t) (inner - outer + 1))
+		{
+		  printf ("%s flunked bounded for outer = %d, inner = %d\n",
+			  STRINGIFY (STRNLEN), outer, inner);
+		  result = 1;
+		}
+	    }
+        }
+
+      /* strchr/wcschr test */
+      for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
+        {
+	  for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
+	    {
+	      for (inner = middle; inner < nchars; ++inner)
+		{
+		  adr[middle] = L('V');
+		  adr[inner] = L('\0');
+
+		  CHAR *cp = STRCHR (&adr[outer], L('V'));
 
 		  if ((inner == middle && cp != NULL)
 		      || (inner != middle
 			  && (cp - &adr[outer]) != middle - outer))
 		    {
-		      printf ("strchr flunked for outer = %d, middle = %d, "
-			      "inner = %d\n", outer, middle, inner);
+		      printf ("%s flunked for outer = %d, middle = %d, "
+			      "inner = %d\n",
+			      STRINGIFY (STRCHR), outer, middle, inner);
 		      result = 1;
 		    }
 
-		  adr[inner] = 'T';
-		  adr[middle] = 'T';
+		  adr[inner] = L('T');
+		  adr[middle] = L('T');
 		}
 	    }
         }
 
       /* Special test.  */
-      adr[size - 1] = '\0';
-      if (strchr (&adr[size - 1], '\n') != NULL)
+      adr[nchars - 1] = L('\0');
+      if (STRCHR (&adr[nchars - 1], L('\n')) != NULL)
 	{
-	  puts ("strchr flunked for test of empty string at end of page");
+	  printf ("%s flunked test of empty string at end of page\n",
+		  STRINGIFY (STRCHR));
 	  result = 1;
 	}
 
-      /* strrchr test */
-      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
-        {
-	  for (middle = MAX (outer, size - 64); middle < size; ++middle)
-	    {
-	      for (inner = middle; inner < size; ++inner)
-		{
-		  char *cp;
-		  adr[middle] = 'V';
-		  adr[inner] = '\0';
-
-		  cp = strrchr (&adr[outer], 'V');
+      /* strrchr/wcsrchr test */
+      for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
+        {
+	  for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
+	    {
+	      for (inner = middle; inner < nchars; ++inner)
+		{
+		  adr[middle] = L('V');
+		  adr[inner] = L('\0');
+
+		  CHAR *cp = STRRCHR (&adr[outer], L('V'));
 
 		  if ((inner == middle && cp != NULL)
 		      || (inner != middle
 			  && (cp - &adr[outer]) != middle - outer))
 		    {
-		      printf ("strrchr flunked for outer = %d, middle = %d, "
-			      "inner = %d\n", outer, middle, inner);
+		      printf ("%s flunked for outer = %d, middle = %d, "
+			      "inner = %d\n",
+			      STRINGIFY (STRRCHR), outer, middle, inner);
 		      result = 1;
 		    }
 
-		  adr[inner] = 'T';
-		  adr[middle] = 'T';
-		}
-	    }
-        }
-
+		  adr[inner] = L('T');
+		  adr[middle] = L('T');
+		}
+	    }
+        }
+
+      /* This function only exists for single-byte characters.  */
+#ifndef WCSTEST
       /* rawmemchr test */
-      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
-        {
-	  for (middle = MAX (outer, size - 64); middle < size; ++middle)
-	    {
-	      char *cp;
-	      adr[middle] = 'V';
-
-	      cp = rawmemchr (&adr[outer], 'V');
+      for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
+        {
+	  for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
+	    {
+	      adr[middle] = L('V');
+
+	      CHAR *cp = rawmemchr (&adr[outer], L('V'));
 
 	      if (cp - &adr[outer] != middle - outer)
 		{
-		  printf ("rawmemchr flunked for outer = %d, middle = %d\n",
-			  outer, middle);
-		  result = 1;
-		}
-
-	      adr[middle] = 'T';
-	    }
-        }
-
-      /* strcpy test */
-      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
-        {
-          for (inner = MAX (outer, size - 64); inner < size; ++inner)
-	    {
-	      adr[inner] = '\0';
-
-	      if (strcpy (dest, &adr[outer]) != dest
-		  || strlen (dest) != (size_t) (inner - outer))
-		{
-		  printf ("strcpy flunked for outer = %d, inner = %d\n",
-			  outer, inner);
-		  result = 1;
-		}
-
-	      adr[inner] = 'T';
+		  printf ("%s flunked for outer = %d, middle = %d\n",
+			  STRINGIFY (rawmemchr), outer, middle);
+		  result = 1;
+		}
+
+	      adr[middle] = L('T');
+	    }
+        }
+#endif
+
+      /* strcpy/wcscpy test */
+      for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
+        {
+          for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
+	    {
+	      adr[inner] = L('\0');
+
+	      if (STRCPY (dest, &adr[outer]) != dest
+		  || STRLEN (dest) != (size_t) (inner - outer))
+		{
+		  printf ("%s flunked for outer = %d, inner = %d\n",
+			  STRINGIFY (STRCPY), outer, inner);
+		  result = 1;
+		}
+
+	      adr[inner] = L('T');
 	    }
         }
 
       /* strncpy tests */
-      adr[size-1] = 'T';
-      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+      adr[nchars - 1] = L('T');
+      for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
 	{
 	  size_t len;
 
-	  for (len = 0; len < size - outer; ++len)
-	    {
-	      if (strncpy (dest, &adr[outer], len) != dest
-		  || memcmp (dest, &adr[outer], len) != 0)
-		{
-		  printf ("outer strncpy flunked for outer = %d, len = %Zd\n",
-			  outer, len);
-		  result = 1;
-		}
-	    }
-        }
-      adr[size-1] = '\0';
-
-      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
-        {
-          for (inner = MAX (outer, size - 64); inner < size; ++inner)
+	  for (len = 0; len < nchars - outer; ++len)
+	    {
+	      if (STRNCPY (dest, &adr[outer], len) != dest
+		  || MEMCMP (dest, &adr[outer], len) != 0)
+		{
+		  printf ("outer %s flunked for outer = %d, len = %Zd\n",
+			  STRINGIFY (STRNCPY), outer, len);
+		  result = 1;
+		}
+	    }
+        }
+      adr[nchars - 1] = L('\0');
+
+      for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
+        {
+          for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
 	    {
 	      size_t len;
 
-	      adr[inner] = '\0';
-
-	      for (len = 0; len < size - outer + 64; ++len)
-		{
-		  if (strncpy (dest, &adr[outer], len) != dest
-		      || memcmp (dest, &adr[outer],
+	      adr[inner] = L('\0');
+
+	      for (len = 0; len < nchars - outer + 64; ++len)
+		{
+		  if (STRNCPY (dest, &adr[outer], len) != dest
+		      || MEMCMP (dest, &adr[outer],
 				 MIN (inner - outer, len)) != 0
 		      || (inner - outer < len
-			  && strlen (dest) != (inner - outer)))
+			  && STRLEN (dest) != (inner - outer)))
 		    {
-		      printf ("strncpy flunked for outer = %d, inner = %d, len = %Zd\n",
-			      outer, inner, len);
+		      printf ("%s flunked for outer = %d, inner = %d, "
+			      "len = %Zd\n",
+			      STRINGIFY (STRNCPY), outer, inner, len);
 		      result = 1;
 		    }
-		  if (strncpy (dest + 1, &adr[outer], len) != dest + 1
-		      || memcmp (dest + 1, &adr[outer],
+		  if (STRNCPY (dest + 1, &adr[outer], len) != dest + 1
+		      || MEMCMP (dest + 1, &adr[outer],
 				 MIN (inner - outer, len)) != 0
 		      || (inner - outer < len
-			  && strlen (dest + 1) != (inner - outer)))
+			  && STRLEN (dest + 1) != (inner - outer)))
 		    {
-		      printf ("strncpy+1 flunked for outer = %d, inner = %d, len = %Zd\n",
-			      outer, inner, len);
+		      printf ("%s+1 flunked for outer = %d, inner = %d, "
+			      "len = %Zd\n",
+			      STRINGIFY (STRNCPY), outer, inner, len);
 		      result = 1;
 		    }
 		}
 
-	      adr[inner] = 'T';
-	    }
-        }
-
-      /* stpcpy test */
-      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
-        {
-          for (inner = MAX (outer, size - 64); inner < size; ++inner)
-	    {
-	      adr[inner] = '\0';
-
-	      if ((stpcpy (dest, &adr[outer]) - dest) != inner - outer)
-		{
-		  printf ("stpcpy flunked for outer = %d, inner = %d\n",
-			  outer, inner);
-		  result = 1;
-		}
-
-	      adr[inner] = 'T';
-	    }
-        }
-
-      /* stpncpy test */
-      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
-        {
-          for (middle = MAX (outer, size - 64); middle < size; ++middle)
-	    {
-	      adr[middle] = '\0';
-
-	      for (inner = 0; inner < size - outer; ++ inner)
-		{
-		  if ((stpncpy (dest, &adr[outer], inner) - dest)
+	      adr[inner] = L('T');
+	    }
+        }
+
+      /* stpcpy/wcpcpy test */
+      for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
+        {
+          for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
+	    {
+	      adr[inner] = L('\0');
+
+	      if ((STPCPY (dest, &adr[outer]) - dest) != inner - outer)
+		{
+		  printf ("%s flunked for outer = %d, inner = %d\n",
+			  STRINGIFY (STPCPY), outer, inner);
+		  result = 1;
+		}
+
+	      adr[inner] = L('T');
+	    }
+        }
+
+      /* stpncpy/wcpncpy test */
+      for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
+        {
+          for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle)
+	    {
+	      adr[middle] = L('\0');
+
+	      for (inner = 0; inner < nchars - outer; ++ inner)
+		{
+		  if ((STPNCPY (dest, &adr[outer], inner) - dest)
 		      != MIN (inner, middle - outer))
 		    {
-		      printf ("stpncpy flunked for outer = %d, middle = %d, "
-			      "inner = %d\n", outer, middle, inner);
+		      printf ("%s flunked for outer = %d, middle = %d, "
+			      "inner = %d\n",
+			      STRINGIFY (STPNCPY), outer, middle, inner);
 		      result = 1;
 		    }
 		}
 
-	      adr[middle] = 'T';
-	    }
-        }
-
-      /* memcpy test */
-      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
-	for (inner = 0; inner < size - outer; ++inner)
-	  if (memcpy (dest, &adr[outer], inner) !=  dest)
-	    {
-	      printf ("memcpy flunked for outer = %d, inner = %d\n",
-		      outer, inner);
+	      adr[middle] = L('T');
+	    }
+        }
+
+      /* memcpy/wmemcpy test */
+      for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
+	for (inner = 0; inner < nchars - outer; ++inner)
+	  if (MEMCPY (dest, &adr[outer], inner) !=  dest)
+	    {
+	      printf ("%s flunked for outer = %d, inner = %d\n",
+		      STRINGIFY (MEMCPY), outer, inner);
 	      result = 1;
 	    }
 
-      /* mempcpy test */
-      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
-	for (inner = 0; inner < size - outer; ++inner)
-	  if (mempcpy (dest, &adr[outer], inner) !=  dest + inner)
-	    {
-	      printf ("mempcpy flunked for outer = %d, inner = %d\n",
-		      outer, inner);
+      /* mempcpy/wmempcpy test */
+      for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
+	for (inner = 0; inner < nchars - outer; ++inner)
+	  if (MEMPCPY (dest, &adr[outer], inner) !=  dest + inner)
+	    {
+	      printf ("%s flunked for outer = %d, inner = %d\n",
+		      STRINGIFY (MEMPCPY), outer, inner);
 	      result = 1;
 	    }
 
+      /* This function only exists for single-byte characters.  */
+#ifndef WCSTEST
       /* memccpy test */
-      memset (adr, '\0', size);
-      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
-	for (inner = 0; inner < size - outer; ++inner)
-	  if (memccpy (dest, &adr[outer], '\1', inner) != NULL)
+      memset (adr, '\0', nchars);
+      for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
+	for (inner = 0; inner < nchars - outer; ++inner)
+	  if (memccpy (dest, &adr[outer], L('\1'), inner) != NULL)
 	    {
 	      printf ("memccpy flunked full copy for outer = %d, inner = %d\n",
 		      outer, inner);
 	      result = 1;
 	    }
-      for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
-	for (middle = 0; middle < size - outer; ++middle)
+      for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
+	for (middle = 0; middle < nchars - outer; ++middle)
 	  {
-	    memset (dest, '\2', middle + 1);
+	    memset (dest, L('\2'), middle + 1);
 	    for (inner = 0; inner < middle; ++inner)
 	      {
-		adr[outer + inner] = '\1';
+		adr[outer + inner] = L('\1');
 
 		if (memccpy (dest, &adr[outer], '\1', middle + 128)
 		    !=  dest + inner + 1)
@@ -333,17 +393,21 @@
 			    outer, middle, inner);
 		    result = 1;
 		  }
-		else if (dest[inner + 1] != '\2')
+		else if (dest[inner + 1] != L('\2'))
 		  {
 		    printf ("\
 memccpy copied too much for outer = %d, middle = %d, inner = %d\n",
 			    outer, middle, inner);
 		    result = 1;
 		  }
-		adr[outer + inner] = '\0';
+		adr[outer + inner] = L('\0');
 	      }
 	  }
+#endif
     }
 
   return result;
 }
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Modified: fsf/trunk/libc/wcsmbs/Makefile
==============================================================================
--- fsf/trunk/libc/wcsmbs/Makefile (original)
+++ fsf/trunk/libc/wcsmbs/Makefile Mon Sep 24 00:03:30 2007
@@ -43,7 +43,8 @@
 	    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
+	 tst-wcrtomb tst-wcpncpy tst-mbsrtowcs tst-wchar-h tst-mbrtowc2 \
+	 wcsatcliff
 
 include ../Rules
 

Added: fsf/trunk/libc/wcsmbs/wcsatcliff.c
==============================================================================
--- fsf/trunk/libc/wcsmbs/wcsatcliff.c (added)
+++ fsf/trunk/libc/wcsmbs/wcsatcliff.c Mon Sep 24 00:03:30 2007
@@ -1,0 +1,20 @@
+#include <wchar.h>
+
+#define WCSTEST 1
+#define L(c) L##c
+#define CHAR wchar_t
+#define MEMSET wmemset
+#define STRLEN wcslen
+#define STRNLEN wcsnlen
+#define STRCHR wcschr
+#define STRRCHR wcsrchr
+#define STRCPY wcscpy
+#define STRNCPY wcsncpy
+#define MEMCMP wmemcmp
+#define STPCPY wcpcpy
+#define STPNCPY wcpncpy
+#define MEMCPY wmemcpy
+#define MEMPCPY wmempcpy
+
+
+#include "../string/stratcliff.c"

Modified: fsf/trunk/libc/wcsmbs/wcsnlen.c
==============================================================================
--- fsf/trunk/libc/wcsmbs/wcsnlen.c (original)
+++ fsf/trunk/libc/wcsmbs/wcsnlen.c Mon Sep 24 00:03:30 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1998.
 
@@ -28,13 +28,16 @@
 {
   size_t len = 0;
 
-  while (s[len] != L'\0' && maxlen > 0)
+  while (maxlen > 0 && s[len] != L'\0')
     {
-      if (s[++len] == L'\0' || --maxlen == 0)
+      ++len;
+      if (--maxlen == 0 || s[len] == L'\0')
 	return len;
-      if (s[++len] == L'\0' || --maxlen == 0)
+      ++len;
+      if (--maxlen == 0 || s[len] == L'\0')
 	return len;
-      if (s[++len] == L'\0' || --maxlen == 0)
+      ++len;
+      if (--maxlen == 0 || s[len] == L'\0')
 	return len;
       ++len;
       --maxlen;