diff options
author | Zack Weinberg <zackw@panix.com> | 2017-06-08 15:39:03 -0400 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2017-06-08 15:39:03 -0400 |
commit | 5046dbb4a7eba5eccfd258f92f4735c9ffc8d069 (patch) | |
tree | 4470480d904b65cf14ca524f96f79eca818c3eaf /REORG.TODO/posix/bug-regex1.c | |
parent | 199fc19d3aaaf57944ef036e15904febe877fc93 (diff) | |
download | glibc-zack/build-layout-experiment.tar glibc-zack/build-layout-experiment.tar.gz glibc-zack/build-layout-experiment.tar.bz2 glibc-zack/build-layout-experiment.zip |
Prepare for radical source tree reorganization.zack/build-layout-experiment
All top-level files and directories are moved into a temporary storage
directory, REORG.TODO, except for files that will certainly still
exist in their current form at top level when we're done (COPYING,
COPYING.LIB, LICENSES, NEWS, README), all old ChangeLog files (which
are moved to the new directory OldChangeLogs, instead), and the
generated file INSTALL (which is just deleted; in the new order, there
will be no generated files checked into version control).
Diffstat (limited to 'REORG.TODO/posix/bug-regex1.c')
-rw-r--r-- | REORG.TODO/posix/bug-regex1.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/REORG.TODO/posix/bug-regex1.c b/REORG.TODO/posix/bug-regex1.c new file mode 100644 index 0000000000..38eb543951 --- /dev/null +++ b/REORG.TODO/posix/bug-regex1.c @@ -0,0 +1,65 @@ +/* Test case by Jim Meyering <jim@meyering.net>. */ +#include <locale.h> +#include <stdio.h> +#include <string.h> +#include <regex.h> +#include <wchar.h> + +int +main (void) +{ + struct re_pattern_buffer regex; + struct re_registers regs; + const char *s; + int match; + int result = 0; + + memset (®ex, '\0', sizeof (regex)); + + setlocale (LC_ALL, "de_DE.ISO-8859-1"); + fwide (stdout, -1); + + re_set_syntax (RE_SYNTAX_POSIX_EGREP | RE_DEBUG); + + puts ("in C locale"); + setlocale (LC_ALL, "C"); + s = re_compile_pattern ("[anù]*n", 7, ®ex); + if (s != NULL) + { + puts ("re_compile_pattern return non-NULL value"); + result = 1; + } + else + { + match = re_match (®ex, "an", 2, 0, ®s); + if (match != 2) + { + printf ("re_match returned %d, expected 2\n", match); + result = 1; + } + else + puts (" -> OK"); + } + + puts ("in de_DE.ISO-8859-1 locale"); + setlocale (LC_ALL, "de_DE.ISO-8859-1"); + s = re_compile_pattern ("[anù]*n", 7, ®ex); + if (s != NULL) + { + puts ("re_compile_pattern return non-NULL value"); + result = 1; + } + else + { + match = re_match (®ex, "an", 2, 0, ®s); + if (match != 2) + { + printf ("re_match returned %d, expected 2\n", match); + result = 1; + } + else + puts (" -> OK"); + } + + return result; +} |