0b26f7
commit 466f2be6c08070e9113ae2fdc7acd5d8828cba50
0b26f7
Author: Carlos O'Donell <carlos@redhat.com>
0b26f7
Date:   Wed Sep 1 15:19:19 2021 -0400
0b26f7
0b26f7
    Add generic C.UTF-8 locale (Bug 17318)
0b26f7
    
0b26f7
    We add a new C.UTF-8 locale. This locale is not builtin to glibc, but
0b26f7
    is provided as a distinct locale. The locale provides full support for
0b26f7
    UTF-8 and this includes full code point sorting via STRCMP-based
0b26f7
    collation (strcmp or wcscmp).
0b26f7
    
0b26f7
    The collation uses a new keyword 'codepoint_collation' which drops all
0b26f7
    collation rules and generates an empty zero rules collation to enable
0b26f7
    STRCMP usage in collation. This ensures that we get full code point
0b26f7
    sorting for C.UTF-8 with a minimal 1406 bytes of overhead (LC_COLLATE
0b26f7
    structure information and ASCII collating tables).
0b26f7
    
0b26f7
    The new locale is added to SUPPORTED. Minimal test data for specific
0b26f7
    code points (minus those not supported by collate-test) is provided in
0b26f7
    C.UTF-8.in, and this verifies code point sorting is working reasonably
0b26f7
    across the range. The locale was tested manually with the full set of
0b26f7
    code points without failure.
0b26f7
    
0b26f7
    The locale is harmonized with locales already shipping in various
0b26f7
    downstream distributions. A new tst-iconv9 test is added which verifies
0b26f7
    the C.UTF-8 locale is generally usable.
0b26f7
    
0b26f7
    Testing for fnmatch, regexec, and recomp is provided by extending
0b26f7
    bug-regex1, bugregex19, bug-regex4, bug-regex6, transbug, tst-fnmatch,
0b26f7
    tst-regcomp-truncated, and tst-regex to use C.UTF-8.
0b26f7
    
0b26f7
    Tested on x86_64 or i686 without regression.
0b26f7
    
0b26f7
    Reviewed-by: Florian Weimer <fweimer@redhat.com>
0b26f7
0b26f7
diff --git a/iconv/Makefile b/iconv/Makefile
0b26f7
index 07d77c9ecaafba1f..9993f2d3f3cd7498 100644
0b26f7
--- a/iconv/Makefile
0b26f7
+++ b/iconv/Makefile
0b26f7
@@ -43,8 +43,19 @@ CFLAGS-charmap.c += -DCHARMAP_PATH='"$(i18ndir)/charmaps"' \
0b26f7
 CFLAGS-linereader.c += -DNO_TRANSLITERATION
0b26f7
 CFLAGS-simple-hash.c += -I../locale
0b26f7
 
0b26f7
-tests	= tst-iconv1 tst-iconv2 tst-iconv3 tst-iconv4 tst-iconv5 tst-iconv6 \
0b26f7
-	  tst-iconv7 tst-iconv8 tst-iconv-mt tst-iconv-opt
0b26f7
+tests = \
0b26f7
+	tst-iconv1 \
0b26f7
+	tst-iconv2 \
0b26f7
+	tst-iconv3 \
0b26f7
+	tst-iconv4 \
0b26f7
+	tst-iconv5 \
0b26f7
+	tst-iconv6 \
0b26f7
+	tst-iconv7 \
0b26f7
+	tst-iconv8 \
0b26f7
+	tst-iconv9 \
0b26f7
+	tst-iconv-mt \
0b26f7
+	tst-iconv-opt \
0b26f7
+	# tests
0b26f7
 
0b26f7
 others		= iconv_prog iconvconfig
0b26f7
 install-others-programs	= $(inst_bindir)/iconv
0b26f7
@@ -83,10 +94,15 @@ endif
0b26f7
 include ../Rules
0b26f7
 
0b26f7
 ifeq ($(run-built-tests),yes)
0b26f7
-LOCALES := en_US.UTF-8
0b26f7
+# We have to generate locales (list sorted alphabetically)
0b26f7
+LOCALES := \
0b26f7
+	C.UTF-8 \
0b26f7
+	en_US.UTF-8 \
0b26f7
+	# LOCALES
0b26f7
 include ../gen-locales.mk
0b26f7
 
0b26f7
 $(objpfx)tst-iconv-opt.out: $(gen-locales)
0b26f7
+$(objpfx)tst-iconv9.out: $(gen-locales)
0b26f7
 endif
0b26f7
 
0b26f7
 $(inst_bindir)/iconv: $(objpfx)iconv_prog $(+force)
0b26f7
diff --git a/iconv/tst-iconv9.c b/iconv/tst-iconv9.c
0b26f7
new file mode 100644
0b26f7
index 0000000000000000..c46b1833d87b8e55
0b26f7
--- /dev/null
0b26f7
+++ b/iconv/tst-iconv9.c
0b26f7
@@ -0,0 +1,87 @@
0b26f7
+/* Verify that using C.UTF-8 works.
0b26f7
+
0b26f7
+   Copyright (C) 2021 Free Software Foundation, Inc.
0b26f7
+   This file is part of the GNU C Library.
0b26f7
+
0b26f7
+   The GNU C Library is free software; you can redistribute it and/or
0b26f7
+   modify it under the terms of the GNU Lesser General Public
0b26f7
+   License as published by the Free Software Foundation; either
0b26f7
+   version 2.1 of the License, or (at your option) any later version.
0b26f7
+
0b26f7
+   The GNU C Library is distributed in the hope that it will be useful,
0b26f7
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
0b26f7
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0b26f7
+   Lesser General Public License for more details.
0b26f7
+
0b26f7
+   You should have received a copy of the GNU Lesser General Public
0b26f7
+   License along with the GNU C Library; if not, see
0b26f7
+   <https://www.gnu.org/licenses/>.  */
0b26f7
+
0b26f7
+#include <iconv.h>
0b26f7
+#include <stddef.h>
0b26f7
+#include <stdio.h>
0b26f7
+#include <string.h>
0b26f7
+#include <support/support.h>
0b26f7
+#include <support/check.h>
0b26f7
+
0b26f7
+/* This test does two things:
0b26f7
+   (1) Verify that we have likely included translit_combining in C.UTF-8.
0b26f7
+   (2) Verify default_missing is '?' as expected.  */
0b26f7
+
0b26f7
+/* ISO-8859-1 encoding of "für".  */
0b26f7
+char iso88591_in[] = { 0x66, 0xfc, 0x72, 0x0 };
0b26f7
+/* ASCII transliteration is "fur" with C.UTF-8 translit_combining.  */
0b26f7
+char ascii_exp[] = { 0x66, 0x75, 0x72, 0x0 };
0b26f7
+
0b26f7
+/* First 3-byte UTF-8 code point.  */
0b26f7
+char utf8_in[] = { 0xe0, 0xa0, 0x80, 0x0 };
0b26f7
+/* There is no ASCII transliteration for SAMARITAN LETTER ALAF
0b26f7
+   so we get default_missing used which is '?'.  */
0b26f7
+char default_missing_exp[] = { 0x3f, 0x0 };
0b26f7
+
0b26f7
+static int
0b26f7
+do_test (void)
0b26f7
+{
0b26f7
+  char ascii_out[5];
0b26f7
+  iconv_t cd;
0b26f7
+  char *inbuf;
0b26f7
+  char *outbuf;
0b26f7
+  size_t inbytes;
0b26f7
+  size_t outbytes;
0b26f7
+  size_t n;
0b26f7
+
0b26f7
+  /* The C.UTF-8 locale should include translit_combining, which provides
0b26f7
+     the transliteration for "LATIN SMALL LETTER U WITH DIAERESIS" which
0b26f7
+     is not provided by locale/C-translit.h.in.  */
0b26f7
+  xsetlocale (LC_ALL, "C.UTF-8");
0b26f7
+
0b26f7
+  /* From ISO-8859-1 to ASCII.  */
0b26f7
+  cd = iconv_open ("ASCII//TRANSLIT,IGNORE", "ISO-8859-1");
0b26f7
+  TEST_VERIFY (cd != (iconv_t) -1);
0b26f7
+  inbuf = iso88591_in;
0b26f7
+  inbytes = 3;
0b26f7
+  outbuf = ascii_out;
0b26f7
+  outbytes = 3;
0b26f7
+  n = iconv (cd, &inbuf, &inbytes, &outbuf, &outbytes);
0b26f7
+  TEST_VERIFY (n != -1);
0b26f7
+  *outbuf = '\0';
0b26f7
+  TEST_COMPARE_BLOB (ascii_out, 3, ascii_exp, 3);
0b26f7
+  TEST_VERIFY (iconv_close (cd) == 0);
0b26f7
+
0b26f7
+  /* From UTF-8 to ASCII.  */
0b26f7
+  cd = iconv_open ("ASCII//TRANSLIT,IGNORE", "UTF-8");
0b26f7
+  TEST_VERIFY (cd != (iconv_t) -1);
0b26f7
+  inbuf = utf8_in;
0b26f7
+  inbytes = 3;
0b26f7
+  outbuf = ascii_out;
0b26f7
+  outbytes = 3;
0b26f7
+  n = iconv (cd, &inbuf, &inbytes, &outbuf, &outbytes);
0b26f7
+  TEST_VERIFY (n != -1);
0b26f7
+  *outbuf = '\0';
0b26f7
+  TEST_COMPARE_BLOB (ascii_out, 1, default_missing_exp, 1);
0b26f7
+  TEST_VERIFY (iconv_close (cd) == 0);
0b26f7
+
0b26f7
+  return 0;
0b26f7
+}
0b26f7
+
0b26f7
+#include <support/test-driver.c>
0b26f7
diff --git a/localedata/C.UTF-8.in b/localedata/C.UTF-8.in
0b26f7
new file mode 100644
0b26f7
index 0000000000000000..c31dcc2aa045ee61
0b26f7
--- /dev/null
0b26f7
+++ b/localedata/C.UTF-8.in
0b26f7
@@ -0,0 +1,157 @@
0b26f7
+? ; <U1>
0b26f7
+? ; <U2>
0b26f7
+? ; <U3>
0b26f7
+? ; <U4>
0b26f7
+? ; <U5>
0b26f7
+? ; <U6>
0b26f7
+? ; <U7>
0b26f7
+? ; <U8>
0b26f7
+? ; <UE>
0b26f7
+? ; <UF>
0b26f7
+? ; <U10>
0b26f7
+? ; <U11>
0b26f7
+? ; <U12>
0b26f7
+? ; <U13>
0b26f7
+? ; <U14>
0b26f7
+? ; <U15>
0b26f7
+? ; <U16>
0b26f7
+? ; <U17>
0b26f7
+? ; <U18>
0b26f7
+? ; <U19>
0b26f7
+? ; <U1A>
0b26f7
+? ; <U1B>
0b26f7
+? ; <U1C>
0b26f7
+? ; <U1D>
0b26f7
+? ; <U1E>
0b26f7
+? ; <U1F>
0b26f7
+! ; <U21>
0b26f7
+" ; <U22>
0b26f7
+# ; <U23>
0b26f7
+$ ; <U24>
0b26f7
+% ; <U25>
0b26f7
+& ; <U26>
0b26f7
+' ; <U27>
0b26f7
+) ; <U29>
0b26f7
+* ; <U2A>
0b26f7
++ ; <U2B>
0b26f7
+, ; <U2C>
0b26f7
+- ; <U2D>
0b26f7
+. ; <U2E>
0b26f7
+/ ; <U2F>
0b26f7
+0 ; <U30>
0b26f7
+1 ; <U31>
0b26f7
+2 ; <U32>
0b26f7
+3 ; <U33>
0b26f7
+4 ; <U34>
0b26f7
+5 ; <U35>
0b26f7
+6 ; <U36>
0b26f7
+7 ; <U37>
0b26f7
+8 ; <U38>
0b26f7
+9 ; <U39>
0b26f7
+< ; <U3C>
0b26f7
+= ; <U3D>
0b26f7
+> ; <U3E>
0b26f7
+? ; <U3F>
0b26f7
+@ ; <U40>
0b26f7
+A ; <U41>
0b26f7
+B ; <U42>
0b26f7
+C ; <U43>
0b26f7
+D ; <U44>
0b26f7
+E ; <U45>
0b26f7
+F ; <U46>
0b26f7
+G ; <U47>
0b26f7
+H ; <U48>
0b26f7
+I ; <U49>
0b26f7
+J ; <U4A>
0b26f7
+K ; <U4B>
0b26f7
+L ; <U4C>
0b26f7
+M ; <U4D>
0b26f7
+N ; <U4E>
0b26f7
+O ; <U4F>
0b26f7
+P ; <U50>
0b26f7
+Q ; <U51>
0b26f7
+R ; <U52>
0b26f7
+S ; <U53>
0b26f7
+T ; <U54>
0b26f7
+U ; <U55>
0b26f7
+V ; <U56>
0b26f7
+W ; <U57>
0b26f7
+X ; <U58>
0b26f7
+Y ; <U59>
0b26f7
+Z ; <U5A>
0b26f7
+[ ; <U5B>
0b26f7
+\ ; <U5C>
0b26f7
+] ; <U5D>
0b26f7
+^ ; <U5E>
0b26f7
+_ ; <U5F>
0b26f7
+` ; <U60>
0b26f7
+a ; <U61>
0b26f7
+b ; <U62>
0b26f7
+c ; <U63>
0b26f7
+d ; <U64>
0b26f7
+e ; <U65>
0b26f7
+f ; <U66>
0b26f7
+g ; <U67>
0b26f7
+h ; <U68>
0b26f7
+i ; <U69>
0b26f7
+j ; <U6A>
0b26f7
+k ; <U6B>
0b26f7
+l ; <U6C>
0b26f7
+m ; <U6D>
0b26f7
+n ; <U6E>
0b26f7
+o ; <U6F>
0b26f7
+p ; <U70>
0b26f7
+q ; <U71>
0b26f7
+r ; <U72>
0b26f7
+s ; <U73>
0b26f7
+t ; <U74>
0b26f7
+u ; <U75>
0b26f7
+v ; <U76>
0b26f7
+w ; <U77>
0b26f7
+x ; <U78>
0b26f7
+y ; <U79>
0b26f7
+z ; <U7A>
0b26f7
+{ ; <U7B>
0b26f7
+| ; <U7C>
0b26f7
+} ; <U7D>
0b26f7
+~ ; <U7E>
0b26f7
+ ; <U7F>
0b26f7
+€ ; <U80>
0b26f7
+ÿ ; <UFF>
0b26f7
+Ā ; <U100>
0b26f7
+à¿¿ ; <UFFF>
0b26f7
+က ; <U1000>
0b26f7
+� ; <UFFFD>
0b26f7
+ï¿¿ ; <UFFFF>
0b26f7
+𐀀 ; <U10000>
0b26f7
+🿿 ; <U1FFFF>
0b26f7
+ğ €€ ; <U20000>
0b26f7
+𯿿 ; <U2FFFF>
0b26f7
+ğ°€€ ; <U30000>
0b26f7
+ğ¿¿¾ ; <U3FFFE>
0b26f7
+񀀀 ; <U40000>
0b26f7
+񏿿 ; <U4FFFF>
0b26f7
+񐀀 ; <U50000>
0b26f7
+񟿿 ; <U5FFFF>
0b26f7
+񠀀 ; <U60000>
0b26f7
+񯿿 ; <U6FFFF>
0b26f7
+񰀀 ; <U70000>
0b26f7
+ñ¿¿¿ ; <U7FFFF>
0b26f7
+򀀀 ; <U80000>
0b26f7
+򏿿 ; <U8FFFF>
0b26f7
+򐀀 ; <U90000>
0b26f7
+򟿿 ; <U9FFFF>
0b26f7
+򠀀 ; <UA0000>
0b26f7
+򯿿 ; <UAFFFF>
0b26f7
+򰀀 ; <UB0000>
0b26f7
+ò¿¿¿ ; <UBFFFF>
0b26f7
+󀀁 ; <UC0001>
0b26f7
+󏿌 ; <UCFFCC>
0b26f7
+󐀎 ; <UD000E>
0b26f7
+󟿿 ; <UDFFFF>
0b26f7
+󠀁 ; <UE0001>
0b26f7
+󯿿 ; <UEFFFF>
0b26f7
+󰀁 ; <UF0001>
0b26f7
+ó¿¿¿ ; <UFFFFF>
0b26f7
+􀀁 ; <U100001>
0b26f7
+􏿿 ; <U10FFFF>
0b26f7
diff --git a/localedata/Makefile b/localedata/Makefile
0b26f7
index 0341528b0407ae3b..c9dd5a954e8194cc 100644
0b26f7
--- a/localedata/Makefile
0b26f7
+++ b/localedata/Makefile
0b26f7
@@ -47,6 +47,7 @@ test-input := \
0b26f7
 	bg_BG.UTF-8 \
0b26f7
 	br_FR.UTF-8 \
0b26f7
 	bs_BA.UTF-8 \
0b26f7
+	C.UTF-8 \
0b26f7
 	ckb_IQ.UTF-8 \
0b26f7
 	cmn_TW.UTF-8 \
0b26f7
 	crh_UA.UTF-8 \
0b26f7
@@ -206,6 +207,7 @@ LOCALES := \
0b26f7
 	bg_BG.UTF-8 \
0b26f7
 	br_FR.UTF-8 \
0b26f7
 	bs_BA.UTF-8 \
0b26f7
+	C.UTF-8 \
0b26f7
 	ckb_IQ.UTF-8 \
0b26f7
 	cmn_TW.UTF-8 \
0b26f7
 	crh_UA.UTF-8 \
0b26f7
diff --git a/localedata/SUPPORTED b/localedata/SUPPORTED
0b26f7
index 34f7a7c3fe2b6526..546ce6cea16a8fdb 100644
0b26f7
--- a/localedata/SUPPORTED
0b26f7
+++ b/localedata/SUPPORTED
0b26f7
@@ -79,6 +79,7 @@ brx_IN/UTF-8 \
0b26f7
 bs_BA.UTF-8/UTF-8 \
0b26f7
 bs_BA/ISO-8859-2 \
0b26f7
 byn_ER/UTF-8 \
0b26f7
+C.UTF-8/UTF-8 \
0b26f7
 ca_AD.UTF-8/UTF-8 \
0b26f7
 ca_AD/ISO-8859-15 \
0b26f7
 ca_ES.UTF-8/UTF-8 \
0b26f7
diff --git a/localedata/locales/C b/localedata/locales/C
0b26f7
new file mode 100644
0b26f7
index 0000000000000000..ca801c79cf7e953e
0b26f7
--- /dev/null
0b26f7
+++ b/localedata/locales/C
0b26f7
@@ -0,0 +1,194 @@
0b26f7
+escape_char /
0b26f7
+comment_char %
0b26f7
+% Locale for C locale in UTF-8
0b26f7
+
0b26f7
+LC_IDENTIFICATION
0b26f7
+title      "C locale"
0b26f7
+source     ""
0b26f7
+address    ""
0b26f7
+contact    ""
0b26f7
+email      "bug-glibc-locales@gnu.org"
0b26f7
+tel        ""
0b26f7
+fax        ""
0b26f7
+language   ""
0b26f7
+territory  ""
0b26f7
+revision   "2.0"
0b26f7
+date       "2020-06-28"
0b26f7
+category  "i18n:2012";LC_IDENTIFICATION
0b26f7
+category  "i18n:2012";LC_CTYPE
0b26f7
+category  "i18n:2012";LC_COLLATE
0b26f7
+category  "i18n:2012";LC_TIME
0b26f7
+category  "i18n:2012";LC_NUMERIC
0b26f7
+category  "i18n:2012";LC_MONETARY
0b26f7
+category  "i18n:2012";LC_MESSAGES
0b26f7
+category  "i18n:2012";LC_PAPER
0b26f7
+category  "i18n:2012";LC_NAME
0b26f7
+category  "i18n:2012";LC_ADDRESS
0b26f7
+category  "i18n:2012";LC_TELEPHONE
0b26f7
+category  "i18n:2012";LC_MEASUREMENT
0b26f7
+END LC_IDENTIFICATION
0b26f7
+
0b26f7
+LC_CTYPE
0b26f7
+% Include only the i18n character type classes without any of the
0b26f7
+% transliteration that i18n uses by default.
0b26f7
+copy "i18n_ctype"
0b26f7
+
0b26f7
+% Include the neutral transliterations.  The builtin C and
0b26f7
+% POSIX locales have +1600 transliterations that are built into
0b26f7
+% the locales, and these are a superset of those.
0b26f7
+translit_start
0b26f7
+include "translit_neutral";""
0b26f7
+% We must use '?' for default_missing because the transliteration
0b26f7
+% framework includes it directly into the output and so it must
0b26f7
+% be compatible with ASCII if that is the target character set.
0b26f7
+default_missing <U003F>
0b26f7
+translit_end
0b26f7
+
0b26f7
+% Include the transliterations that can convert combined characters.
0b26f7
+% These are generally expected by users.
0b26f7
+translit_start
0b26f7
+include "translit_combining";""
0b26f7
+translit_end
0b26f7
+
0b26f7
+END LC_CTYPE
0b26f7
+
0b26f7
+LC_COLLATE
0b26f7
+% The keyword 'codepoint_collation' in any part of any LC_COLLATE
0b26f7
+% immediately discards all collation information and causes the
0b26f7
+% locale to use strcmp/wcscmp for collation comparison.  This is
0b26f7
+% exactly what is needed for C (ASCII) or C.UTF-8.
0b26f7
+codepoint_collation
0b26f7
+END LC_COLLATE
0b26f7
+
0b26f7
+LC_MONETARY
0b26f7
+
0b26f7
+% This is the 14652 i18n fdcc-set definition for the LC_MONETARY
0b26f7
+% category (except for the int_curr_symbol and currency_symbol, they are
0b26f7
+% empty in the 14652 i18n fdcc-set definition and also empty in
0b26f7
+% glibc/locale/C-monetary.c.).
0b26f7
+int_curr_symbol     ""
0b26f7
+currency_symbol     ""
0b26f7
+mon_decimal_point   "."
0b26f7
+mon_thousands_sep   ""
0b26f7
+mon_grouping        -1
0b26f7
+positive_sign       ""
0b26f7
+negative_sign       "-"
0b26f7
+int_frac_digits     -1
0b26f7
+frac_digits         -1
0b26f7
+p_cs_precedes       -1
0b26f7
+int_p_sep_by_space  -1
0b26f7
+p_sep_by_space      -1
0b26f7
+n_cs_precedes       -1
0b26f7
+int_n_sep_by_space  -1
0b26f7
+n_sep_by_space      -1
0b26f7
+p_sign_posn         -1
0b26f7
+n_sign_posn         -1
0b26f7
+%
0b26f7
+END LC_MONETARY
0b26f7
+
0b26f7
+LC_NUMERIC
0b26f7
+% This is the POSIX Locale definition for
0b26f7
+% the LC_NUMERIC category.
0b26f7
+%
0b26f7
+decimal_point   "."
0b26f7
+thousands_sep   ""
0b26f7
+grouping        -1
0b26f7
+END LC_NUMERIC
0b26f7
+
0b26f7
+LC_TIME
0b26f7
+% This is the POSIX Locale definition for the LC_TIME category with the
0b26f7
+% exception that time is per ISO 8601 and 24-hour.
0b26f7
+%
0b26f7
+% Abbreviated weekday names (%a)
0b26f7
+abday       "Sun";"Mon";"Tue";"Wed";"Thu";"Fri";"Sat"
0b26f7
+
0b26f7
+% Full weekday names (%A)
0b26f7
+day         "Sunday";"Monday";"Tuesday";"Wednesday";"Thursday";/
0b26f7
+            "Friday";"Saturday"
0b26f7
+
0b26f7
+% Abbreviated month names (%b)
0b26f7
+abmon       "Jan";"Feb";"Mar";"Apr";"May";"Jun";"Jul";"Aug";"Sep";/
0b26f7
+            "Oct";"Nov";"Dec"
0b26f7
+
0b26f7
+% Full month names (%B)
0b26f7
+mon         "January";"February";"March";"April";"May";"June";"July";/
0b26f7
+            "August";"September";"October";"November";"December"
0b26f7
+
0b26f7
+% Week description, consists of three fields:
0b26f7
+% 1. Number of days in a week.
0b26f7
+% 2. Gregorian date that is a first weekday (19971130 for Sunday, 19971201 for Monday).
0b26f7
+% 3. The weekday number to be contained in the first week of the year.
0b26f7
+%
0b26f7
+% ISO 8601 conforming applications should use the values 7, 19971201 (a
0b26f7
+% Monday), and 4 (Thursday), respectively.
0b26f7
+week    7;19971201;4
0b26f7
+first_weekday	1
0b26f7
+first_workday	2
0b26f7
+
0b26f7
+% Appropriate date and time representation (%c)
0b26f7
+d_t_fmt "%a %b %e %H:%M:%S %Y"
0b26f7
+
0b26f7
+% Appropriate date representation (%x)
0b26f7
+d_fmt   "%m/%d/%y"
0b26f7
+
0b26f7
+% Appropriate time representation (%X)
0b26f7
+t_fmt   "%H:%M:%S"
0b26f7
+
0b26f7
+% Appropriate AM/PM time representation (%r)
0b26f7
+t_fmt_ampm "%I:%M:%S %p"
0b26f7
+
0b26f7
+% Equivalent of AM/PM (%p)
0b26f7
+am_pm	"AM";"PM"
0b26f7
+
0b26f7
+% Appropriate date representation (date(1))
0b26f7
+date_fmt	"%a %b %e %H:%M:%S %Z %Y"
0b26f7
+END LC_TIME
0b26f7
+
0b26f7
+LC_MESSAGES
0b26f7
+% This is the POSIX Locale definition for
0b26f7
+% the LC_NUMERIC category.
0b26f7
+%
0b26f7
+yesexpr "^[yY]"
0b26f7
+noexpr  "^[nN]"
0b26f7
+yesstr  "Yes"
0b26f7
+nostr   "No"
0b26f7
+END LC_MESSAGES
0b26f7
+
0b26f7
+LC_PAPER
0b26f7
+% This is the ISO/IEC 14652 "i18n" definition for
0b26f7
+% the LC_PAPER category.
0b26f7
+% (A4 paper, this is also used in the built in C/POSIX
0b26f7
+% locale in glibc/locale/C-paper.c)
0b26f7
+height   297
0b26f7
+width    210
0b26f7
+END LC_PAPER
0b26f7
+
0b26f7
+LC_NAME
0b26f7
+% This is the ISO/IEC 14652 "i18n" definition for
0b26f7
+% the LC_NAME category.
0b26f7
+% (also used in the built in C/POSIX locale in glibc/locale/C-name.c)
0b26f7
+name_fmt    "%p%t%g%t%m%t%f"
0b26f7
+END LC_NAME
0b26f7
+
0b26f7
+LC_ADDRESS
0b26f7
+% This is the ISO/IEC 14652 "i18n" definition for
0b26f7
+% the LC_ADDRESS category.
0b26f7
+% (also used in the built in C/POSIX locale in glibc/locale/C-address.c)
0b26f7
+postal_fmt    "%a%N%f%N%d%N%b%N%s %h %e %r%N%C-%z %T%N%c%N"
0b26f7
+END LC_ADDRESS
0b26f7
+
0b26f7
+LC_TELEPHONE
0b26f7
+% This is the ISO/IEC 14652 "i18n" definition for
0b26f7
+% the LC_TELEPHONE category.
0b26f7
+% "+%c %a %l"
0b26f7
+tel_int_fmt    "+%c %a %l"
0b26f7
+% (also used in the built in C/POSIX locale in glibc/locale/C-telephone.c)
0b26f7
+END LC_TELEPHONE
0b26f7
+
0b26f7
+LC_MEASUREMENT
0b26f7
+% This is the ISO/IEC 14652 "i18n" definition for
0b26f7
+% the LC_MEASUREMENT category.
0b26f7
+% (same as in the built in C/POSIX locale in glibc/locale/C-measurement.c)
0b26f7
+%metric
0b26f7
+measurement    1
0b26f7
+END LC_MEASUREMENT
0b26f7
diff --git a/posix/Makefile b/posix/Makefile
0b26f7
index 059efb3cd2706cbe..a5229777eeb0e067 100644
0b26f7
--- a/posix/Makefile
0b26f7
+++ b/posix/Makefile
0b26f7
@@ -190,9 +190,19 @@ $(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
0b26f7
 	$(evaluate-test)
0b26f7
 endif
0b26f7
 
0b26f7
-LOCALES := cs_CZ.UTF-8 da_DK.ISO-8859-1 de_DE.ISO-8859-1 de_DE.UTF-8 \
0b26f7
-	   en_US.UTF-8 es_US.ISO-8859-1 es_US.UTF-8 ja_JP.EUC-JP tr_TR.UTF-8 \
0b26f7
-	   cs_CZ.ISO-8859-2
0b26f7
+LOCALES := \
0b26f7
+	cs_CZ.ISO-8859-2 \
0b26f7
+	cs_CZ.UTF-8 \
0b26f7
+	C.UTF-8 \
0b26f7
+	da_DK.ISO-8859-1 \
0b26f7
+	de_DE.ISO-8859-1 \
0b26f7
+	de_DE.UTF-8 \
0b26f7
+	en_US.UTF-8 \
0b26f7
+	es_US.ISO-8859-1 \
0b26f7
+	es_US.UTF-8 \
0b26f7
+	ja_JP.EUC-JP \
0b26f7
+	tr_TR.UTF-8 \
0b26f7
+	# LOCALES
0b26f7
 include ../gen-locales.mk
0b26f7
 
0b26f7
 $(objpfx)bug-regex1.out: $(gen-locales)
0b26f7
diff --git a/posix/bug-regex1.c b/posix/bug-regex1.c
0b26f7
index 38eb543951862492..7e9f4ec430a95631 100644
0b26f7
--- a/posix/bug-regex1.c
0b26f7
+++ b/posix/bug-regex1.c
0b26f7
@@ -41,6 +41,26 @@ main (void)
0b26f7
 	puts (" -> OK");
0b26f7
     }
0b26f7
 
0b26f7
+  puts ("in C.UTF-8 locale");
0b26f7
+  setlocale (LC_ALL, "C.UTF-8");
0b26f7
+  s = re_compile_pattern ("[an\371]*n", 7, &regex);
0b26f7
+  if (s != NULL)
0b26f7
+    {
0b26f7
+      puts ("re_compile_pattern return non-NULL value");
0b26f7
+      result = 1;
0b26f7
+    }
0b26f7
+  else
0b26f7
+    {
0b26f7
+      match = re_match (&regex, "an", 2, 0, ®s;;
0b26f7
+      if (match != 2)
0b26f7
+	{
0b26f7
+	  printf ("re_match returned %d, expected 2\n", match);
0b26f7
+	  result = 1;
0b26f7
+	}
0b26f7
+      else
0b26f7
+	puts (" -> OK");
0b26f7
+    }
0b26f7
+
0b26f7
   puts ("in de_DE.ISO-8859-1 locale");
0b26f7
   setlocale (LC_ALL, "de_DE.ISO-8859-1");
0b26f7
   s = re_compile_pattern ("[anù]*n", 7, &regex);
0b26f7
diff --git a/posix/bug-regex19.c b/posix/bug-regex19.c
0b26f7
index b3fee0a7302c3263..e00ff60a14f994bf 100644
0b26f7
--- a/posix/bug-regex19.c
0b26f7
+++ b/posix/bug-regex19.c
0b26f7
@@ -25,6 +25,7 @@
0b26f7
 #include <string.h>
0b26f7
 #include <locale.h>
0b26f7
 #include <libc-diag.h>
0b26f7
+#include <support/support.h>
0b26f7
 
0b26f7
 #define BRE RE_SYNTAX_POSIX_BASIC
0b26f7
 #define ERE RE_SYNTAX_POSIX_EXTENDED
0b26f7
@@ -407,8 +408,8 @@ do_mb_tests (const struct test_s *test)
0b26f7
   return 0;
0b26f7
 }
0b26f7
 
0b26f7
-int
0b26f7
-main (void)
0b26f7
+static int
0b26f7
+do_test (void)
0b26f7
 {
0b26f7
   size_t i;
0b26f7
   int ret = 0;
0b26f7
@@ -417,20 +418,17 @@ main (void)
0b26f7
 
0b26f7
   for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
0b26f7
     {
0b26f7
-      if (setlocale (LC_ALL, "de_DE.ISO-8859-1") == NULL)
0b26f7
-	{
0b26f7
-	  puts ("setlocale de_DE.ISO-8859-1 failed");
0b26f7
-	  ret = 1;
0b26f7
-	}
0b26f7
+      xsetlocale (LC_ALL, "de_DE.ISO-8859-1");
0b26f7
       ret |= do_one_test (&tests[i], "");
0b26f7
-      if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
0b26f7
-	{
0b26f7
-	  puts ("setlocale de_DE.UTF-8 failed");
0b26f7
-	  ret = 1;
0b26f7
-	}
0b26f7
+      xsetlocale (LC_ALL, "de_DE.UTF-8");
0b26f7
+      ret |= do_one_test (&tests[i], "UTF-8 ");
0b26f7
+      ret |= do_mb_tests (&tests[i]);
0b26f7
+      xsetlocale (LC_ALL, "C.UTF-8");
0b26f7
       ret |= do_one_test (&tests[i], "UTF-8 ");
0b26f7
       ret |= do_mb_tests (&tests[i]);
0b26f7
     }
0b26f7
 
0b26f7
   return ret;
0b26f7
 }
0b26f7
+
0b26f7
+#include <support/test-driver.c>
0b26f7
diff --git a/posix/bug-regex4.c b/posix/bug-regex4.c
0b26f7
index 8d5ae11567889301..6475833c525176b2 100644
0b26f7
--- a/posix/bug-regex4.c
0b26f7
+++ b/posix/bug-regex4.c
0b26f7
@@ -32,8 +32,33 @@ main (void)
0b26f7
 
0b26f7
   memset (&regex, '\0', sizeof (regex));
0b26f7
 
0b26f7
+  printf ("INFO: Checking C.\n");
0b26f7
   setlocale (LC_ALL, "C");
0b26f7
 
0b26f7
+  s = re_compile_pattern ("ab[cde]", 7, &regex);
0b26f7
+  if (s != NULL)
0b26f7
+    {
0b26f7
+      puts ("re_compile_pattern returned non-NULL value");
0b26f7
+      result = 1;
0b26f7
+    }
0b26f7
+  else
0b26f7
+    {
0b26f7
+      match[0] = re_search_2 (&regex, "xyabez", 6, "", 0, 1, 5, NULL, 6);
0b26f7
+      match[1] = re_search_2 (&regex, NULL, 0, "abc", 3, 0, 3, NULL, 3);
0b26f7
+      match[2] = re_search_2 (&regex, "xya", 3, "bd", 2, 2, 3, NULL, 5);
0b26f7
+      if (match[0] != 2 || match[1] != 0 || match[2] != 2)
0b26f7
+	{
0b26f7
+	  printf ("re_search_2 returned %d,%d,%d, expected 2,0,2\n",
0b26f7
+		  match[0], match[1], match[2]);
0b26f7
+	  result = 1;
0b26f7
+	}
0b26f7
+      else
0b26f7
+	puts (" -> OK");
0b26f7
+    }
0b26f7
+
0b26f7
+  printf ("INFO: Checking C.UTF-8.\n");
0b26f7
+  setlocale (LC_ALL, "C.UTF-8");
0b26f7
+
0b26f7
   s = re_compile_pattern ("ab[cde]", 7, &regex);
0b26f7
   if (s != NULL)
0b26f7
     {
0b26f7
diff --git a/posix/bug-regex6.c b/posix/bug-regex6.c
0b26f7
index 2bdf2126a49ee99b..0929b69b83c91e5e 100644
0b26f7
--- a/posix/bug-regex6.c
0b26f7
+++ b/posix/bug-regex6.c
0b26f7
@@ -30,7 +30,7 @@ main (int argc, char *argv[])
0b26f7
   regex_t re;
0b26f7
   regmatch_t mat[10];
0b26f7
   int i, j, ret = 0;
0b26f7
-  const char *locales[] = { "C", "de_DE.UTF-8" };
0b26f7
+  const char *locales[] = { "C", "C.UTF-8", "de_DE.UTF-8" };
0b26f7
   const char *string = "http://www.regex.com/pattern/matching.html#intro";
0b26f7
   regmatch_t expect[10] = {
0b26f7
     { 0, 48 }, { 0, 5 }, { 0, 4 }, { 5, 20 }, { 7, 20 }, { 20, 42 },
0b26f7
diff --git a/posix/transbug.c b/posix/transbug.c
0b26f7
index d0983b4d44d04fd2..b240177cf72326ff 100644
0b26f7
--- a/posix/transbug.c
0b26f7
+++ b/posix/transbug.c
0b26f7
@@ -116,16 +116,32 @@ do_test (void)
0b26f7
   static const char lower[] = "[[:lower:]]+";
0b26f7
   static const char upper[] = "[[:upper:]]+";
0b26f7
   struct re_registers regs[4];
0b26f7
+  int result = 0;
0b26f7
 
0b26f7
+#define CHECK(exp) \
0b26f7
+  if (exp) { puts (#exp); result = 1; }
0b26f7
+
0b26f7
+  printf ("INFO: Checking C.\n");
0b26f7
   setlocale (LC_ALL, "C");
0b26f7
 
0b26f7
   (void) re_set_syntax (RE_SYNTAX_GNU_AWK);
0b26f7
 
0b26f7
-  int result;
0b26f7
-#define CHECK(exp) \
0b26f7
-  if (exp) { puts (#exp); result = 1; }
0b26f7
+  result |= run_test (lower, regs);
0b26f7
+  result |= run_test (upper, &regs[2]);
0b26f7
+  if (! result)
0b26f7
+    {
0b26f7
+      CHECK (regs[0].start[0] != regs[2].start[0]);
0b26f7
+      CHECK (regs[0].end[0] != regs[2].end[0]);
0b26f7
+      CHECK (regs[1].start[0] != regs[3].start[0]);
0b26f7
+      CHECK (regs[1].end[0] != regs[3].end[0]);
0b26f7
+    }
0b26f7
+
0b26f7
+  printf ("INFO: Checking C.UTF-8.\n");
0b26f7
+  setlocale (LC_ALL, "C.UTF-8");
0b26f7
+
0b26f7
+  (void) re_set_syntax (RE_SYNTAX_GNU_AWK);
0b26f7
 
0b26f7
-  result = run_test (lower, regs);
0b26f7
+  result |= run_test (lower, regs);
0b26f7
   result |= run_test (upper, &regs[2]);
0b26f7
   if (! result)
0b26f7
     {
0b26f7
diff --git a/posix/tst-fnmatch.input b/posix/tst-fnmatch.input
0b26f7
index 67aac5aadafd8aeb..6ff5318032e0afb2 100644
0b26f7
--- a/posix/tst-fnmatch.input
0b26f7
+++ b/posix/tst-fnmatch.input
0b26f7
@@ -472,6 +472,397 @@ C		"\\"			"[Z-\\]]"	       0
0b26f7
 C		"]"			"[Z-\\]]"	       0
0b26f7
 C		"-"			"[Z-\\]]"	       NOMATCH
0b26f7
 
0b26f7
+# B.6 004(C)
0b26f7
+C.UTF-8		 "!#%+,-./01234567889"	"!#%+,-./01234567889"  0
0b26f7
+C.UTF-8		 ":;=@ABCDEFGHIJKLMNO"	":;=@ABCDEFGHIJKLMNO"  0
0b26f7
+C.UTF-8		 "PQRSTUVWXYZ]abcdefg"	"PQRSTUVWXYZ]abcdefg"  0
0b26f7
+C.UTF-8		 "hijklmnopqrstuvwxyz"	"hijklmnopqrstuvwxyz"  0
0b26f7
+C.UTF-8		 "^_{}~"		"^_{}~"		       0
0b26f7
+
0b26f7
+# B.6 005(C)
0b26f7
+C.UTF-8		 "\"$&'()"		"\\\"\\$\\&\\'\\(\\)"  0
0b26f7
+C.UTF-8		 "*?[\\`|"		"\\*\\?\\[\\\\\\`\\|"  0
0b26f7
+C.UTF-8		 "<>"			"\\<\\>"	       0
0b26f7
+
0b26f7
+# B.6 006(C)
0b26f7
+C.UTF-8		 "?*["			"[?*[][?*[][?*[]"      0
0b26f7
+C.UTF-8		 "a/b"			"?/b"		       0
0b26f7
+
0b26f7
+# B.6 007(C)
0b26f7
+C.UTF-8		 "a/b"			"a?b"		       0
0b26f7
+C.UTF-8		 "a/b"			"a/?"		       0
0b26f7
+C.UTF-8		 "aa/b"			"?/b"		       NOMATCH
0b26f7
+C.UTF-8		 "aa/b"			"a?b"		       NOMATCH
0b26f7
+C.UTF-8		 "a/bb"			"a/?"		       NOMATCH
0b26f7
+
0b26f7
+# B.6 009(C)
0b26f7
+C.UTF-8		 "abc"			"[abc]"		       NOMATCH
0b26f7
+C.UTF-8		 "x"			"[abc]"		       NOMATCH
0b26f7
+C.UTF-8		 "a"			"[abc]"		       0
0b26f7
+C.UTF-8		 "["			"[[abc]"	       0
0b26f7
+C.UTF-8		 "a"			"[][abc]"	       0
0b26f7
+C.UTF-8		 "a]"			"[]a]]"		       0
0b26f7
+
0b26f7
+# B.6 010(C)
0b26f7
+C.UTF-8		 "xyz"			"[!abc]"	       NOMATCH
0b26f7
+C.UTF-8		 "x"			"[!abc]"	       0
0b26f7
+C.UTF-8		 "a"			"[!abc]"	       NOMATCH
0b26f7
+
0b26f7
+# B.6 011(C)
0b26f7
+C.UTF-8		 "]"			"[][abc]"	       0
0b26f7
+C.UTF-8		 "abc]"			"[][abc]"	       NOMATCH
0b26f7
+C.UTF-8		 "[]abc"		"[][]abc"	       NOMATCH
0b26f7
+C.UTF-8		 "]"			"[!]]"		       NOMATCH
0b26f7
+C.UTF-8		 "aa]"			"[!]a]"		       NOMATCH
0b26f7
+C.UTF-8		 "]"			"[!a]"		       0
0b26f7
+C.UTF-8		 "]]"			"[!a]]"		       0
0b26f7
+
0b26f7
+# B.6 012(C)
0b26f7
+C.UTF-8		 "a"			"[[.a.]]"	       0
0b26f7
+C.UTF-8		 "-"			"[[.-.]]"	       0
0b26f7
+C.UTF-8		 "-"			"[[.-.][.].]]"	       0
0b26f7
+C.UTF-8		 "-"			"[[.].][.-.]]"	       0
0b26f7
+C.UTF-8		 "-"			"[[.-.][=u=]]"	       0
0b26f7
+C.UTF-8		 "-"			"[[.-.][:alpha:]]"     0
0b26f7
+C.UTF-8		 "a"			"[![.a.]]"	       NOMATCH
0b26f7
+
0b26f7
+# B.6 013(C)
0b26f7
+C.UTF-8		 "a"			"[[.b.]]"	       NOMATCH
0b26f7
+C.UTF-8		 "a"			"[[.b.][.c.]]"	       NOMATCH
0b26f7
+C.UTF-8		 "a"			"[[.b.][=b=]]"	       NOMATCH
0b26f7
+
0b26f7
+
0b26f7
+# B.6 015(C)
0b26f7
+C.UTF-8		 "a"			"[[=a=]]"	       0
0b26f7
+C.UTF-8		 "b"			"[[=a=]b]"	       0
0b26f7
+C.UTF-8		 "b"			"[[=a=][=b=]]"	       0
0b26f7
+C.UTF-8		 "a"			"[[=a=][=b=]]"	       0
0b26f7
+C.UTF-8		 "a"			"[[=a=][.b.]]"	       0
0b26f7
+C.UTF-8		 "a"			"[[=a=][:digit:]]"     0
0b26f7
+
0b26f7
+# B.6 016(C)
0b26f7
+C.UTF-8		 "="			"[[=a=]b]"	       NOMATCH
0b26f7
+C.UTF-8		 "]"			"[[=a=]b]"	       NOMATCH
0b26f7
+C.UTF-8		 "a"			"[[=b=][=c=]]"	       NOMATCH
0b26f7
+C.UTF-8		 "a"			"[[=b=][.].]]"	       NOMATCH
0b26f7
+C.UTF-8		 "a"			"[[=b=][:digit:]]"     NOMATCH
0b26f7
+
0b26f7
+# B.6 017(C)
0b26f7
+C.UTF-8		 "a"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "a"			"[![:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "-"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "a]a"			"[[:alnum:]]a"	       NOMATCH
0b26f7
+C.UTF-8		 "-"			"[[:alnum:]-]"	       0
0b26f7
+C.UTF-8		 "aa"			"[[:alnum:]]a"	       0
0b26f7
+C.UTF-8		 "-"			"[![:alnum:]]"	       0
0b26f7
+C.UTF-8		 "]"			"[!][:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "["			"[![:alnum:][]"	       NOMATCH
0b26f7
+C.UTF-8		 "a"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "b"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "c"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "d"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "e"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "f"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "g"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "h"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "i"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "j"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "k"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "l"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "m"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "n"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "o"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "p"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "q"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "r"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "s"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "t"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "u"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "v"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "w"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "x"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "y"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "z"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "A"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "B"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "C"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "D"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "E"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "F"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "G"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "H"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "I"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "J"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "K"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "L"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "M"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "N"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "O"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "P"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "Q"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "R"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "S"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "T"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "U"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "V"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "W"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "X"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "Y"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "Z"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "0"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "1"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "2"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "3"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "4"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "5"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "6"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "7"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "8"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "9"			"[[:alnum:]]"	       0
0b26f7
+C.UTF-8		 "!"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "#"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "%"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "+"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 ","			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "-"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "."			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "/"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 ":"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 ";"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "="			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "@"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "["			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "\\"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "]"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "^"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "_"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "{"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "}"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "~"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "\""			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "$"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "&"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "'"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "("			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 ")"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "*"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "?"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "`"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "|"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "<"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 ">"			"[[:alnum:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "\t"			"[[:cntrl:]]"	       0
0b26f7
+C.UTF-8		 "t"			"[[:cntrl:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "t"			"[[:lower:]]"	       0
0b26f7
+C.UTF-8		 "\t"			"[[:lower:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "T"			"[[:lower:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "\t"			"[[:space:]]"	       0
0b26f7
+C.UTF-8		 "t"			"[[:space:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "t"			"[[:alpha:]]"	       0
0b26f7
+C.UTF-8		 "\t"			"[[:alpha:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "0"			"[[:digit:]]"	       0
0b26f7
+C.UTF-8		 "\t"			"[[:digit:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "t"			"[[:digit:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "\t"			"[[:print:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "t"			"[[:print:]]"	       0
0b26f7
+C.UTF-8		 "T"			"[[:upper:]]"	       0
0b26f7
+C.UTF-8		 "\t"			"[[:upper:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "t"			"[[:upper:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "\t"			"[[:blank:]]"	       0
0b26f7
+C.UTF-8		 "t"			"[[:blank:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "\t"			"[[:graph:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "t"			"[[:graph:]]"	       0
0b26f7
+C.UTF-8		 "."			"[[:punct:]]"	       0
0b26f7
+C.UTF-8		 "t"			"[[:punct:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "\t"			"[[:punct:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "0"			"[[:xdigit:]]"	       0
0b26f7
+C.UTF-8		 "\t"			"[[:xdigit:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "a"			"[[:xdigit:]]"	       0
0b26f7
+C.UTF-8		 "A"			"[[:xdigit:]]"	       0
0b26f7
+C.UTF-8		 "t"			"[[:xdigit:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "a"			"[[alpha]]"	       NOMATCH
0b26f7
+C.UTF-8		 "a"			"[[alpha:]]"	       NOMATCH
0b26f7
+C.UTF-8		 "a]"			"[[alpha]]"	       0
0b26f7
+C.UTF-8		 "a]"			"[[alpha:]]"	       0
0b26f7
+C.UTF-8		 "a"			"[[:alpha:][.b.]]"     0
0b26f7
+C.UTF-8		 "a"			"[[:alpha:][=b=]]"     0
0b26f7
+C.UTF-8		 "a"			"[[:alpha:][:digit:]]" 0
0b26f7
+C.UTF-8		 "a"			"[[:digit:][:alpha:]]" 0
0b26f7
+
0b26f7
+# B.6 018(C)
0b26f7
+C.UTF-8		 "a"			"[a-c]"		       0
0b26f7
+C.UTF-8		 "b"			"[a-c]"		       0
0b26f7
+C.UTF-8		 "c"			"[a-c]"		       0
0b26f7
+C.UTF-8		 "a"			"[b-c]"		       NOMATCH
0b26f7
+C.UTF-8		 "d"			"[b-c]"		       NOMATCH
0b26f7
+C.UTF-8		 "B"			"[a-c]"		       NOMATCH
0b26f7
+C.UTF-8		 "b"			"[A-C]"		       NOMATCH
0b26f7
+C.UTF-8		 ""			"[a-c]"		       NOMATCH
0b26f7
+C.UTF-8		 "as"			"[a-ca-z]"	       NOMATCH
0b26f7
+C.UTF-8		 "a"			"[[.a.]-c]"	       0
0b26f7
+C.UTF-8		 "a"			"[a-[.c.]]"	       0
0b26f7
+C.UTF-8		 "a"			"[[.a.]-[.c.]]"	       0
0b26f7
+C.UTF-8		 "b"			"[[.a.]-c]"	       0
0b26f7
+C.UTF-8		 "b"			"[a-[.c.]]"	       0
0b26f7
+C.UTF-8		 "b"			"[[.a.]-[.c.]]"	       0
0b26f7
+C.UTF-8		 "c"			"[[.a.]-c]"	       0
0b26f7
+C.UTF-8		 "c"			"[a-[.c.]]"	       0
0b26f7
+C.UTF-8		 "c"			"[[.a.]-[.c.]]"	       0
0b26f7
+C.UTF-8		 "d"			"[[.a.]-c]"	       NOMATCH
0b26f7
+C.UTF-8		 "d"			"[a-[.c.]]"	       NOMATCH
0b26f7
+C.UTF-8		 "d"			"[[.a.]-[.c.]]"	       NOMATCH
0b26f7
+
0b26f7
+# B.6 019(C)
0b26f7
+C.UTF-8		 "a"			"[c-a]"		       NOMATCH
0b26f7
+C.UTF-8		 "a"			"[[.c.]-a]"	       NOMATCH
0b26f7
+C.UTF-8		 "a"			"[c-[.a.]]"	       NOMATCH
0b26f7
+C.UTF-8		 "a"			"[[.c.]-[.a.]]"	       NOMATCH
0b26f7
+C.UTF-8		 "c"			"[c-a]"		       NOMATCH
0b26f7
+C.UTF-8		 "c"			"[[.c.]-a]"	       NOMATCH
0b26f7
+C.UTF-8		 "c"			"[c-[.a.]]"	       NOMATCH
0b26f7
+C.UTF-8		 "c"			"[[.c.]-[.a.]]"	       NOMATCH
0b26f7
+
0b26f7
+# B.6 020(C)
0b26f7
+C.UTF-8		 "a"			"[a-c0-9]"	       0
0b26f7
+C.UTF-8		 "d"			"[a-c0-9]"	       NOMATCH
0b26f7
+C.UTF-8		 "B"			"[a-c0-9]"	       NOMATCH
0b26f7
+
0b26f7
+# B.6 021(C)
0b26f7
+C.UTF-8		 "-"			"[-a]"		       0
0b26f7
+C.UTF-8		 "a"			"[-b]"		       NOMATCH
0b26f7
+C.UTF-8		 "-"			"[!-a]"		       NOMATCH
0b26f7
+C.UTF-8		 "a"			"[!-b]"		       0
0b26f7
+C.UTF-8		 "-"			"[a-c-0-9]"	       0
0b26f7
+C.UTF-8		 "b"			"[a-c-0-9]"	       0
0b26f7
+C.UTF-8		 "a:"			"a[0-9-a]"	       NOMATCH
0b26f7
+C.UTF-8		 "a:"			"a[09-a]"	       0
0b26f7
+
0b26f7
+# B.6 024(C)
0b26f7
+C.UTF-8		 ""			"*"		       0
0b26f7
+C.UTF-8		 "asd/sdf"		"*"		       0
0b26f7
+
0b26f7
+# B.6 025(C)
0b26f7
+C.UTF-8		 "as"			"[a-c][a-z]"	       0
0b26f7
+C.UTF-8		 "as"			"??"		       0
0b26f7
+
0b26f7
+# B.6 026(C)
0b26f7
+C.UTF-8		 "asd/sdf"		"as*df"		       0
0b26f7
+C.UTF-8		 "asd/sdf"		"as*"		       0
0b26f7
+C.UTF-8		 "asd/sdf"		"*df"		       0
0b26f7
+C.UTF-8		 "asd/sdf"		"as*dg"		       NOMATCH
0b26f7
+C.UTF-8		 "asdf"			"as*df"		       0
0b26f7
+C.UTF-8		 "asdf"			"as*df?"	       NOMATCH
0b26f7
+C.UTF-8		 "asdf"			"as*??"		       0
0b26f7
+C.UTF-8		 "asdf"			"a*???"		       0
0b26f7
+C.UTF-8		 "asdf"			"*????"		       0
0b26f7
+C.UTF-8		 "asdf"			"????*"		       0
0b26f7
+C.UTF-8		 "asdf"			"??*?"		       0
0b26f7
+
0b26f7
+# B.6 027(C)
0b26f7
+C.UTF-8		 "/"			"/"		       0
0b26f7
+C.UTF-8		 "/"			"/*"		       0
0b26f7
+C.UTF-8		 "/"			"*/"		       0
0b26f7
+C.UTF-8		 "/"			"/?"		       NOMATCH
0b26f7
+C.UTF-8		 "/"			"?/"		       NOMATCH
0b26f7
+C.UTF-8		 "/"			"?"		       0
0b26f7
+C.UTF-8		 "."			"?"		       0
0b26f7
+C.UTF-8		 "/."			"??"		       0
0b26f7
+C.UTF-8		 "/"			"[!a-c]"	       0
0b26f7
+C.UTF-8		 "."			"[!a-c]"	       0
0b26f7
+
0b26f7
+# B.6 029(C)
0b26f7
+C.UTF-8		 "/"			"/"		       0       PATHNAME
0b26f7
+C.UTF-8		 "//"			"//"		       0       PATHNAME
0b26f7
+C.UTF-8		 "/.a"			"/*"		       0       PATHNAME
0b26f7
+C.UTF-8		 "/.a"			"/?a"		       0       PATHNAME
0b26f7
+C.UTF-8		 "/.a"			"/[!a-z]a"	       0       PATHNAME
0b26f7
+C.UTF-8		 "/.a/.b"		"/*/?b"		       0       PATHNAME
0b26f7
+
0b26f7
+# B.6 030(C)
0b26f7
+C.UTF-8		 "/"			"?"		       NOMATCH PATHNAME
0b26f7
+C.UTF-8		 "/"			"*"		       NOMATCH PATHNAME
0b26f7
+C.UTF-8		 "a/b"			"a?b"		       NOMATCH PATHNAME
0b26f7
+C.UTF-8		 "/.a/.b"		"/*b"		       NOMATCH PATHNAME
0b26f7
+
0b26f7
+# B.6 031(C)
0b26f7
+C.UTF-8		 "/$"			"\\/\\$"	       0
0b26f7
+C.UTF-8		 "/["			"\\/\\["	       0
0b26f7
+C.UTF-8		 "/["			"\\/["		       0
0b26f7
+C.UTF-8		 "/[]"			"\\/\\[]"	       0
0b26f7
+
0b26f7
+# B.6 032(C)
0b26f7
+C.UTF-8		 "/$"			"\\/\\$"	       NOMATCH NOESCAPE
0b26f7
+C.UTF-8		 "/\\$"			"\\/\\$"	       NOMATCH NOESCAPE
0b26f7
+C.UTF-8		 "\\/\\$"		"\\/\\$"	       0       NOESCAPE
0b26f7
+
0b26f7
+# B.6 033(C)
0b26f7
+C.UTF-8		 ".asd"			".*"		       0       PERIOD
0b26f7
+C.UTF-8		 "/.asd"		"*"		       0       PERIOD
0b26f7
+C.UTF-8		 "/as/.df"		"*/?*f"		       0       PERIOD
0b26f7
+C.UTF-8		 "..asd"		".[!a-z]*"	       0       PERIOD
0b26f7
+
0b26f7
+# B.6 034(C)
0b26f7
+C.UTF-8		 ".asd"			"*"		       NOMATCH PERIOD
0b26f7
+C.UTF-8		 ".asd"			"?asd"		       NOMATCH PERIOD
0b26f7
+C.UTF-8		 ".asd"			"[!a-z]*"	       NOMATCH PERIOD
0b26f7
+
0b26f7
+# B.6 035(C)
0b26f7
+C.UTF-8		 "/."			"/."		       0       PATHNAME|PERIOD
0b26f7
+C.UTF-8		 "/.a./.b."		"/.*/.*"	       0       PATHNAME|PERIOD
0b26f7
+C.UTF-8		 "/.a./.b."		"/.??/.??"	       0       PATHNAME|PERIOD
0b26f7
+
0b26f7
+# B.6 036(C)
0b26f7
+C.UTF-8		 "/."			"*"		       NOMATCH PATHNAME|PERIOD
0b26f7
+C.UTF-8		 "/."			"/*"		       NOMATCH PATHNAME|PERIOD
0b26f7
+C.UTF-8		 "/."			"/?"		       NOMATCH PATHNAME|PERIOD
0b26f7
+C.UTF-8		 "/."			"/[!a-z]"	       NOMATCH PATHNAME|PERIOD
0b26f7
+C.UTF-8		 "/a./.b."		"/*/*"		       NOMATCH PATHNAME|PERIOD
0b26f7
+C.UTF-8		 "/a./.b."		"/??/???"	       NOMATCH PATHNAME|PERIOD
0b26f7
+
0b26f7
+# Some home-grown tests.
0b26f7
+C.UTF-8		"foobar"		"foo*[abc]z"	       NOMATCH
0b26f7
+C.UTF-8		"foobaz"		"foo*[abc][xyz]"       0
0b26f7
+C.UTF-8		"foobaz"		"foo?*[abc][xyz]"      0
0b26f7
+C.UTF-8		"foobaz"		"foo?*[abc][x/yz]"     0
0b26f7
+C.UTF-8		"foobaz"		"foo?*[abc]/[xyz]"     NOMATCH PATHNAME
0b26f7
+C.UTF-8		"a"			"a/"                   NOMATCH PATHNAME
0b26f7
+C.UTF-8		"a/"			"a"		       NOMATCH PATHNAME
0b26f7
+C.UTF-8		"//a"			"/a"		       NOMATCH PATHNAME
0b26f7
+C.UTF-8		"/a"			"//a"		       NOMATCH PATHNAME
0b26f7
+C.UTF-8		"az"			"[a-]z"		       0
0b26f7
+C.UTF-8		"bz"			"[ab-]z"	       0
0b26f7
+C.UTF-8		"cz"			"[ab-]z"	       NOMATCH
0b26f7
+C.UTF-8		"-z"			"[ab-]z"	       0
0b26f7
+C.UTF-8		"az"			"[-a]z"		       0
0b26f7
+C.UTF-8		"bz"			"[-ab]z"	       0
0b26f7
+C.UTF-8		"cz"			"[-ab]z"	       NOMATCH
0b26f7
+C.UTF-8		"-z"			"[-ab]z"	       0
0b26f7
+C.UTF-8		"\\"			"[\\\\-a]"	       0
0b26f7
+C.UTF-8		"_"			"[\\\\-a]"	       0
0b26f7
+C.UTF-8		"a"			"[\\\\-a]"	       0
0b26f7
+C.UTF-8		"-"			"[\\\\-a]"	       NOMATCH
0b26f7
+C.UTF-8		"\\"			"[\\]-a]"	       NOMATCH
0b26f7
+C.UTF-8		"_"			"[\\]-a]"	       0
0b26f7
+C.UTF-8		"a"			"[\\]-a]"	       0
0b26f7
+C.UTF-8		"]"			"[\\]-a]"	       0
0b26f7
+C.UTF-8		"-"			"[\\]-a]"	       NOMATCH
0b26f7
+C.UTF-8		"\\"			"[!\\\\-a]"	       NOMATCH
0b26f7
+C.UTF-8		"_"			"[!\\\\-a]"	       NOMATCH
0b26f7
+C.UTF-8		"a"			"[!\\\\-a]"	       NOMATCH
0b26f7
+C.UTF-8		"-"			"[!\\\\-a]"	       0
0b26f7
+C.UTF-8		"!"			"[\\!-]"	       0
0b26f7
+C.UTF-8		"-"			"[\\!-]"	       0
0b26f7
+C.UTF-8		"\\"			"[\\!-]"	       NOMATCH
0b26f7
+C.UTF-8		"Z"			"[Z-\\\\]"	       0
0b26f7
+C.UTF-8		"["			"[Z-\\\\]"	       0
0b26f7
+C.UTF-8		"\\"			"[Z-\\\\]"	       0
0b26f7
+C.UTF-8		"-"			"[Z-\\\\]"	       NOMATCH
0b26f7
+C.UTF-8		"Z"			"[Z-\\]]"	       0
0b26f7
+C.UTF-8		"["			"[Z-\\]]"	       0
0b26f7
+C.UTF-8		"\\"			"[Z-\\]]"	       0
0b26f7
+C.UTF-8		"]"			"[Z-\\]]"	       0
0b26f7
+C.UTF-8		"-"			"[Z-\\]]"	       NOMATCH
0b26f7
+
0b26f7
 # Following are tests outside the scope of IEEE 2003.2 since they are using
0b26f7
 # locales other than the C locale.  The main focus of the tests is on the
0b26f7
 # handling of ranges and the recognition of character (vs bytes).
0b26f7
@@ -677,7 +1068,6 @@ C		 "x/y"			"*"		       0       PATHNAME|LEADING_DIR
0b26f7
 C		 "x/y/z"		"*"		       0       PATHNAME|LEADING_DIR
0b26f7
 C		 "x"			"*x"		       0       PATHNAME|LEADING_DIR
0b26f7
 
0b26f7
-en_US.UTF-8	 "\366.csv"		"*.csv"                0
0b26f7
 C		 "x/y"			"*x"		       0       PATHNAME|LEADING_DIR
0b26f7
 C		 "x/y/z"		"*x"		       0       PATHNAME|LEADING_DIR
0b26f7
 C		 "x"			"x*"		       0       PATHNAME|LEADING_DIR
0b26f7
@@ -693,6 +1083,33 @@ C		 "x"			"x?y"		       NOMATCH PATHNAME|LEADING_DIR
0b26f7
 C		 "x/y"			"x?y"		       NOMATCH PATHNAME|LEADING_DIR
0b26f7
 C		 "x/y/z"		"x?y"		       NOMATCH PATHNAME|LEADING_DIR
0b26f7
 
0b26f7
+# Duplicate the "Test of GNU extensions." tests but for C.UTF-8.
0b26f7
+C.UTF-8		 "x"			"x"		       0       PATHNAME|LEADING_DIR
0b26f7
+C.UTF-8		 "x/y"			"x"		       0       PATHNAME|LEADING_DIR
0b26f7
+C.UTF-8		 "x/y/z"		"x"		       0       PATHNAME|LEADING_DIR
0b26f7
+C.UTF-8		 "x"			"*"		       0       PATHNAME|LEADING_DIR
0b26f7
+C.UTF-8		 "x/y"			"*"		       0       PATHNAME|LEADING_DIR
0b26f7
+C.UTF-8		 "x/y/z"		"*"		       0       PATHNAME|LEADING_DIR
0b26f7
+C.UTF-8		 "x"			"*x"		       0       PATHNAME|LEADING_DIR
0b26f7
+
0b26f7
+C.UTF-8		 "x/y"			"*x"		       0       PATHNAME|LEADING_DIR
0b26f7
+C.UTF-8		 "x/y/z"		"*x"		       0       PATHNAME|LEADING_DIR
0b26f7
+C.UTF-8		 "x"			"x*"		       0       PATHNAME|LEADING_DIR
0b26f7
+C.UTF-8		 "x/y"			"x*"		       0       PATHNAME|LEADING_DIR
0b26f7
+C.UTF-8		 "x/y/z"		"x*"		       0       PATHNAME|LEADING_DIR
0b26f7
+C.UTF-8		 "x"			"a"		       NOMATCH PATHNAME|LEADING_DIR
0b26f7
+C.UTF-8		 "x/y"			"a"		       NOMATCH PATHNAME|LEADING_DIR
0b26f7
+C.UTF-8		 "x/y/z"		"a"		       NOMATCH PATHNAME|LEADING_DIR
0b26f7
+C.UTF-8		 "x"			"x/y"		       NOMATCH PATHNAME|LEADING_DIR
0b26f7
+C.UTF-8		 "x/y"			"x/y"		       0       PATHNAME|LEADING_DIR
0b26f7
+C.UTF-8		 "x/y/z"		"x/y"		       0       PATHNAME|LEADING_DIR
0b26f7
+C.UTF-8		 "x"			"x?y"		       NOMATCH PATHNAME|LEADING_DIR
0b26f7
+C.UTF-8		 "x/y"			"x?y"		       NOMATCH PATHNAME|LEADING_DIR
0b26f7
+C.UTF-8		 "x/y/z"		"x?y"		       NOMATCH PATHNAME|LEADING_DIR
0b26f7
+
0b26f7
+# Bug 14185
0b26f7
+en_US.UTF-8	 "\366.csv"		"*.csv"                0
0b26f7
+
0b26f7
 # ksh style matching.
0b26f7
 C		"abcd"			"?@(a|b)*@(c)d"	       0       EXTMATCH
0b26f7
 C		"/dev/udp/129.22.8.102/45" "/dev/@(tcp|udp)/*/*" 0     PATHNAME|EXTMATCH
0b26f7
@@ -822,3 +1239,133 @@ C		""			""		       0
0b26f7
 C		""			""		       0       EXTMATCH
0b26f7
 C		""			"*([abc])"	       0       EXTMATCH
0b26f7
 C		""			"?([abc])"	       0       EXTMATCH
0b26f7
+
0b26f7
+# Duplicate the "ksh style matching." for C.UTF-8.
0b26f7
+C.UTF-8		"abcd"			"?@(a|b)*@(c)d"	       0       EXTMATCH
0b26f7
+C.UTF-8		"/dev/udp/129.22.8.102/45" "/dev/@(tcp|udp)/*/*" 0     PATHNAME|EXTMATCH
0b26f7
+C.UTF-8		"12"			"[1-9]*([0-9])"        0       EXTMATCH
0b26f7
+C.UTF-8		"12abc"			"[1-9]*([0-9])"        NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"1"			"[1-9]*([0-9])"	       0       EXTMATCH
0b26f7
+C.UTF-8		"07"			"+([0-7])"	       0       EXTMATCH
0b26f7
+C.UTF-8		"0377"			"+([0-7])"	       0       EXTMATCH
0b26f7
+C.UTF-8		"09"			"+([0-7])"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"paragraph"		"para@(chute|graph)"   0       EXTMATCH
0b26f7
+C.UTF-8		"paramour"		"para@(chute|graph)"   NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"para991"		"para?([345]|99)1"     0       EXTMATCH
0b26f7
+C.UTF-8		"para381"		"para?([345]|99)1"     NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"paragraph"		"para*([0-9])"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"para"			"para*([0-9])"	       0       EXTMATCH
0b26f7
+C.UTF-8		"para13829383746592"	"para*([0-9])"	       0       EXTMATCH
0b26f7
+C.UTF-8		"paragraph"		"para+([0-9])"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"para"			"para+([0-9])"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"para987346523"		"para+([0-9])"	       0       EXTMATCH
0b26f7
+C.UTF-8		"paragraph"		"para!(*.[0-9])"       0       EXTMATCH
0b26f7
+C.UTF-8		"para.38"		"para!(*.[0-9])"       0       EXTMATCH
0b26f7
+C.UTF-8		"para.graph"		"para!(*.[0-9])"       0       EXTMATCH
0b26f7
+C.UTF-8		"para39"		"para!(*.[0-9])"       0       EXTMATCH
0b26f7
+C.UTF-8		""			"*(0|1|3|5|7|9)"       0       EXTMATCH
0b26f7
+C.UTF-8		"137577991"		"*(0|1|3|5|7|9)"       0       EXTMATCH
0b26f7
+C.UTF-8		"2468"			"*(0|1|3|5|7|9)"       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"1358"			"*(0|1|3|5|7|9)"       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"file.c"		"*.c?(c)"	       0       EXTMATCH
0b26f7
+C.UTF-8		"file.C"		"*.c?(c)"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"file.cc"		"*.c?(c)"	       0       EXTMATCH
0b26f7
+C.UTF-8		"file.ccc"		"*.c?(c)"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"parse.y"		"!(*.c|*.h|Makefile.in|config*|README)" 0 EXTMATCH
0b26f7
+C.UTF-8		"shell.c"		"!(*.c|*.h|Makefile.in|config*|README)" NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"Makefile"		"!(*.c|*.h|Makefile.in|config*|README)" 0 EXTMATCH
0b26f7
+C.UTF-8		"VMS.FILE;1"		"*\;[1-9]*([0-9])"     0       EXTMATCH
0b26f7
+C.UTF-8		"VMS.FILE;0"		"*\;[1-9]*([0-9])"     NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"VMS.FILE;"		"*\;[1-9]*([0-9])"     NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"VMS.FILE;139"		"*\;[1-9]*([0-9])"     0       EXTMATCH
0b26f7
+C.UTF-8		"VMS.FILE;1N"		"*\;[1-9]*([0-9])"     NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"abcfefg"		"ab**(e|f)"	       0       EXTMATCH
0b26f7
+C.UTF-8		"abcfefg"		"ab**(e|f)g"	       0       EXTMATCH
0b26f7
+C.UTF-8		"ab"			"ab*+(e|f)"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"abef"			"ab***ef"	       0       EXTMATCH
0b26f7
+C.UTF-8		"abef"			"ab**"		       0       EXTMATCH
0b26f7
+C.UTF-8		"fofo"			"*(f*(o))"	       0       EXTMATCH
0b26f7
+C.UTF-8		"ffo"			"*(f*(o))"	       0       EXTMATCH
0b26f7
+C.UTF-8		"foooofo"		"*(f*(o))"	       0       EXTMATCH
0b26f7
+C.UTF-8		"foooofof"		"*(f*(o))"	       0       EXTMATCH
0b26f7
+C.UTF-8		"fooofoofofooo"		"*(f*(o))"	       0       EXTMATCH
0b26f7
+C.UTF-8		"foooofof"		"*(f+(o))"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"xfoooofof"		"*(f*(o))"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"foooofofx"		"*(f*(o))"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"ofxoofxo"		"*(*(of*(o)x)o)"       0       EXTMATCH
0b26f7
+C.UTF-8		"ofooofoofofooo"	"*(f*(o))"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"foooxfooxfoxfooox"	"*(f*(o)x)"	       0       EXTMATCH
0b26f7
+C.UTF-8		"foooxfooxofoxfooox"	"*(f*(o)x)"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"foooxfooxfxfooox"	"*(f*(o)x)"	       0       EXTMATCH
0b26f7
+C.UTF-8		"ofxoofxo"		"*(*(of*(o)x)o)"       0       EXTMATCH
0b26f7
+C.UTF-8		"ofoooxoofxo"		"*(*(of*(o)x)o)"       0       EXTMATCH
0b26f7
+C.UTF-8		"ofoooxoofxoofoooxoofxo" "*(*(of*(o)x)o)"      0       EXTMATCH
0b26f7
+C.UTF-8		"ofoooxoofxoofoooxoofxoo" "*(*(of*(o)x)o)"     0       EXTMATCH
0b26f7
+C.UTF-8		"ofoooxoofxoofoooxoofxofo" "*(*(of*(o)x)o)"    NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"ofoooxoofxoofoooxoofxooofxofxo" "*(*(of*(o)x)o)" 0    EXTMATCH
0b26f7
+C.UTF-8		"aac"			"*(@(a))a@(c)"	       0       EXTMATCH
0b26f7
+C.UTF-8		"ac"			"*(@(a))a@(c)"	       0       EXTMATCH
0b26f7
+C.UTF-8		"c"			"*(@(a))a@(c)"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"aaac"			"*(@(a))a@(c)"	       0       EXTMATCH
0b26f7
+C.UTF-8		"baaac"			"*(@(a))a@(c)"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"abcd"			"?@(a|b)*@(c)d"	       0       EXTMATCH
0b26f7
+C.UTF-8		"abcd"			"@(ab|a*@(b))*(c)d"    0       EXTMATCH
0b26f7
+C.UTF-8		"acd"			"@(ab|a*(b))*(c)d"     0       EXTMATCH
0b26f7
+C.UTF-8		"abbcd"			"@(ab|a*(b))*(c)d"     0       EXTMATCH
0b26f7
+C.UTF-8		"effgz"			"@(b+(c)d|e*(f)g?|?(h)i@(j|k))" 0 EXTMATCH
0b26f7
+C.UTF-8		"efgz"			"@(b+(c)d|e*(f)g?|?(h)i@(j|k))" 0 EXTMATCH
0b26f7
+C.UTF-8		"egz"			"@(b+(c)d|e*(f)g?|?(h)i@(j|k))" 0 EXTMATCH
0b26f7
+C.UTF-8		"egzefffgzbcdij"	"*(b+(c)d|e*(f)g?|?(h)i@(j|k))" 0 EXTMATCH
0b26f7
+C.UTF-8		"egz"			"@(b+(c)d|e+(f)g?|?(h)i@(j|k))" NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"ofoofo"		"*(of+(o))"	       0       EXTMATCH
0b26f7
+C.UTF-8		"oxfoxoxfox"		"*(oxf+(ox))"	       0       EXTMATCH
0b26f7
+C.UTF-8		"oxfoxfox"		"*(oxf+(ox))"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"ofoofo"		"*(of+(o)|f)"	       0       EXTMATCH
0b26f7
+C.UTF-8		"foofoofo"		"@(foo|f|fo)*(f|of+(o))" 0     EXTMATCH
0b26f7
+C.UTF-8		"oofooofo"		"*(of|oof+(o))"	       0       EXTMATCH
0b26f7
+C.UTF-8		"fffooofoooooffoofffooofff" "*(*(f)*(o))"      0       EXTMATCH
0b26f7
+C.UTF-8		"fofoofoofofoo"		"*(fo|foo)"	       0       EXTMATCH
0b26f7
+C.UTF-8		"foo"			"!(x)"		       0       EXTMATCH
0b26f7
+C.UTF-8		"foo"			"!(x)*"		       0       EXTMATCH
0b26f7
+C.UTF-8		"foo"			"!(foo)"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"foo"			"!(foo)*"	       0       EXTMATCH
0b26f7
+C.UTF-8		"foobar"		"!(foo)"	       0       EXTMATCH
0b26f7
+C.UTF-8		"foobar"		"!(foo)*"	       0       EXTMATCH
0b26f7
+C.UTF-8		"moo.cow"		"!(*.*).!(*.*)"	       0       EXTMATCH
0b26f7
+C.UTF-8		"mad.moo.cow"		"!(*.*).!(*.*)"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"mucca.pazza"		"mu!(*(c))?.pa!(*(z))?" NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"fff"			"!(f)"		       0       EXTMATCH
0b26f7
+C.UTF-8		"fff"			"*(!(f))"	       0       EXTMATCH
0b26f7
+C.UTF-8		"fff"			"+(!(f))"	       0       EXTMATCH
0b26f7
+C.UTF-8		"ooo"			"!(f)"		       0       EXTMATCH
0b26f7
+C.UTF-8		"ooo"			"*(!(f))"	       0       EXTMATCH
0b26f7
+C.UTF-8		"ooo"			"+(!(f))"	       0       EXTMATCH
0b26f7
+C.UTF-8		"foo"			"!(f)"		       0       EXTMATCH
0b26f7
+C.UTF-8		"foo"			"*(!(f))"	       0       EXTMATCH
0b26f7
+C.UTF-8		"foo"			"+(!(f))"	       0       EXTMATCH
0b26f7
+C.UTF-8		"f"			"!(f)"		       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"f"			"*(!(f))"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"f"			"+(!(f))"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"foot"			"@(!(z*)|*x)"	       0       EXTMATCH
0b26f7
+C.UTF-8		"zoot"			"@(!(z*)|*x)"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"foox"			"@(!(z*)|*x)"	       0       EXTMATCH
0b26f7
+C.UTF-8		"zoox"			"@(!(z*)|*x)"	       0       EXTMATCH
0b26f7
+C.UTF-8		"foo"			"*(!(foo))"	       0       EXTMATCH
0b26f7
+C.UTF-8		"foob"			"!(foo)b*"	       NOMATCH EXTMATCH
0b26f7
+C.UTF-8		"foobb"			"!(foo)b*"	       0       EXTMATCH
0b26f7
+C.UTF-8		"["			"*([a[])"	       0       EXTMATCH
0b26f7
+C.UTF-8		"]"			"*([]a[])"	       0       EXTMATCH
0b26f7
+C.UTF-8		"a"			"*([]a[])"	       0       EXTMATCH
0b26f7
+C.UTF-8		"b"			"*([!]a[])"	       0       EXTMATCH
0b26f7
+C.UTF-8		"["			"*([!]a[]|[[])"	       0       EXTMATCH
0b26f7
+C.UTF-8		"]"			"*([!]a[]|[]])"	       0       EXTMATCH
0b26f7
+C.UTF-8		"["			"!([!]a[])"	       0       EXTMATCH
0b26f7
+C.UTF-8		"]"			"!([!]a[])"	       0       EXTMATCH
0b26f7
+C.UTF-8		")"			"*([)])"	       0       EXTMATCH
0b26f7
+C.UTF-8		"*"			"*([*(])"	       0       EXTMATCH
0b26f7
+C.UTF-8		"abcd"			"*!(|a)cd"	       0       EXTMATCH
0b26f7
+C.UTF-8		"ab/.a"			"+([abc])/*"	       NOMATCH EXTMATCH|PATHNAME|PERIOD
0b26f7
+C.UTF-8		""			""		       0
0b26f7
+C.UTF-8		""			""		       0       EXTMATCH
0b26f7
+C.UTF-8		""			"*([abc])"	       0       EXTMATCH
0b26f7
+C.UTF-8		""			"?([abc])"	       0       EXTMATCH
0b26f7
diff --git a/posix/tst-regcomp-truncated.c b/posix/tst-regcomp-truncated.c
0b26f7
index 84195fcd2ec153b8..da3f97799e37c607 100644
0b26f7
--- a/posix/tst-regcomp-truncated.c
0b26f7
+++ b/posix/tst-regcomp-truncated.c
0b26f7
@@ -37,6 +37,7 @@
0b26f7
 static const char locales[][17] =
0b26f7
   {
0b26f7
     "C",
0b26f7
+    "C.UTF-8",
0b26f7
     "en_US.UTF-8",
0b26f7
     "de_DE.ISO-8859-1",
0b26f7
   };
0b26f7
diff --git a/posix/tst-regex.c b/posix/tst-regex.c
0b26f7
index e7c2b05e8666a16e..531128de2a9176fa 100644
0b26f7
--- a/posix/tst-regex.c
0b26f7
+++ b/posix/tst-regex.c
0b26f7
@@ -32,6 +32,7 @@
0b26f7
 #include <sys/stat.h>
0b26f7
 #include <sys/types.h>
0b26f7
 #include <regex.h>
0b26f7
+#include <support/support.h>
0b26f7
 
0b26f7
 
0b26f7
 #if defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0
0b26f7
@@ -58,7 +59,7 @@ do_test (void)
0b26f7
   const char *file;
0b26f7
   int fd;
0b26f7
   struct stat st;
0b26f7
-  int result;
0b26f7
+  int result = 0;
0b26f7
   char *inmem;
0b26f7
   char *outmem;
0b26f7
   size_t inlen;
0b26f7
@@ -123,7 +124,7 @@ do_test (void)
0b26f7
 
0b26f7
   /* Run the actual tests.  All tests are run in a single-byte and a
0b26f7
      multi-byte locale.  */
0b26f7
-  result = test_expr ("[äáàâéèêíìîñöóòôüúùû]", 4, 4);
0b26f7
+  result |= test_expr ("[äáàâéèêíìîñöóòôüúùû]", 4, 4);
0b26f7
   result |= test_expr ("G.ran", 2, 3);
0b26f7
   result |= test_expr ("G.\\{1\\}ran", 2, 3);
0b26f7
   result |= test_expr ("G.*ran", 3, 44);
0b26f7
@@ -143,19 +144,33 @@ do_test (void)
0b26f7
 static int
0b26f7
 test_expr (const char *expr, int expected, int expectedicase)
0b26f7
 {
0b26f7
-  int result;
0b26f7
+  int result = 0;
0b26f7
   char *inmem;
0b26f7
   char *outmem;
0b26f7
   size_t inlen;
0b26f7
   size_t outlen;
0b26f7
   char *uexpr;
0b26f7
 
0b26f7
-  /* First test: search with an UTF-8 locale.  */
0b26f7
-  if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
0b26f7
-    error (EXIT_FAILURE, 0, "cannot set locale de_DE.UTF-8");
0b26f7
+  /* First test: search with basic C.UTF-8 locale.  */
0b26f7
+  printf ("INFO: Testing C.UTF-8.\n");
0b26f7
+  xsetlocale (LC_ALL, "C.UTF-8");
0b26f7
 
0b26f7
   printf ("\nTest \"%s\" with multi-byte locale\n", expr);
0b26f7
-  result = run_test (expr, mem, memlen, 0, expected);
0b26f7
+  result |= run_test (expr, mem, memlen, 0, expected);
0b26f7
+  printf ("\nTest \"%s\" with multi-byte locale, case insensitive\n", expr);
0b26f7
+  result |= run_test (expr, mem, memlen, 1, expectedicase);
0b26f7
+  printf ("\nTest \"%s\" backwards with multi-byte locale\n", expr);
0b26f7
+  result |= run_test_backwards (expr, mem, memlen, 0, expected);
0b26f7
+  printf ("\nTest \"%s\" backwards with multi-byte locale, case insensitive\n",
0b26f7
+	  expr);
0b26f7
+  result |= run_test_backwards (expr, mem, memlen, 1, expectedicase);
0b26f7
+
0b26f7
+  /* Second test: search with an UTF-8 locale.  */
0b26f7
+  printf ("INFO: Testing de_DE.UTF-8.\n");
0b26f7
+  xsetlocale (LC_ALL, "de_DE.UTF-8");
0b26f7
+
0b26f7
+  printf ("\nTest \"%s\" with multi-byte locale\n", expr);
0b26f7
+  result |= run_test (expr, mem, memlen, 0, expected);
0b26f7
   printf ("\nTest \"%s\" with multi-byte locale, case insensitive\n", expr);
0b26f7
   result |= run_test (expr, mem, memlen, 1, expectedicase);
0b26f7
   printf ("\nTest \"%s\" backwards with multi-byte locale\n", expr);
0b26f7
@@ -165,8 +180,8 @@ test_expr (const char *expr, int expected, int expectedicase)
0b26f7
   result |= run_test_backwards (expr, mem, memlen, 1, expectedicase);
0b26f7
 
0b26f7
   /* Second test: search with an ISO-8859-1 locale.  */
0b26f7
-  if (setlocale (LC_ALL, "de_DE.ISO-8859-1") == NULL)
0b26f7
-    error (EXIT_FAILURE, 0, "cannot set locale de_DE.ISO-8859-1");
0b26f7
+  printf ("INFO: Testing de_DE.ISO-8859-1.\n");
0b26f7
+  xsetlocale (LC_ALL, "de_DE.ISO-8859-1");
0b26f7
 
0b26f7
   inmem = (char *) expr;
0b26f7
   inlen = strlen (expr);