Compatiblity functions for utmpx on Linux/s390-32.
[glibc/history.git] / posix / bug-regex1.c
blob38eb5439518624929c233f89041698b53220df78
1 /* Test case by Jim Meyering <jim@meyering.net>. */
2 #include <locale.h>
3 #include <stdio.h>
4 #include <string.h>
5 #include <regex.h>
6 #include <wchar.h>
8 int
9 main (void)
11 struct re_pattern_buffer regex;
12 struct re_registers regs;
13 const char *s;
14 int match;
15 int result = 0;
17 memset (&regex, '\0', sizeof (regex));
19 setlocale (LC_ALL, "de_DE.ISO-8859-1");
20 fwide (stdout, -1);
22 re_set_syntax (RE_SYNTAX_POSIX_EGREP | RE_DEBUG);
24 puts ("in C locale");
25 setlocale (LC_ALL, "C");
26 s = re_compile_pattern ("[anù]*n", 7, &regex);
27 if (s != NULL)
29 puts ("re_compile_pattern return non-NULL value");
30 result = 1;
32 else
34 match = re_match (&regex, "an", 2, 0, &regs);
35 if (match != 2)
37 printf ("re_match returned %d, expected 2\n", match);
38 result = 1;
40 else
41 puts (" -> OK");
44 puts ("in de_DE.ISO-8859-1 locale");
45 setlocale (LC_ALL, "de_DE.ISO-8859-1");
46 s = re_compile_pattern ("[anù]*n", 7, &regex);
47 if (s != NULL)
49 puts ("re_compile_pattern return non-NULL value");
50 result = 1;
52 else
54 match = re_match (&regex, "an", 2, 0, &regs);
55 if (match != 2)
57 printf ("re_match returned %d, expected 2\n", match);
58 result = 1;
60 else
61 puts (" -> OK");
64 return result;