1 // BZ 12811
2 #include <regex.h>
3 #include <stdio.h>
4 #include <locale.h>
5
6 static int
do_test(void)7 do_test (void)
8 {
9 char buf[1000];
10 regex_t preg;
11 if (setlocale (LC_CTYPE, "de_DE.UTF-8") == NULL)
12 {
13 puts ("setlocale failed");
14 return 1;
15 }
16
17 int e = regcomp (&preg, ".*ab", REG_ICASE);
18 if (e != 0)
19 {
20 regerror (e, &preg, buf, sizeof (buf));
21 printf ("regcomp = %d \"%s\"\n", e, buf);
22 return 1;
23 }
24
25 // Incomplete character at the end of the buffer
26 e = regexec (&preg, "aaaaaaaaaaaa\xc4", 0, NULL, 0);
27
28 regfree (&preg);
29 regerror (e, &preg, buf, sizeof (buf));
30 printf ("regexec = %d \"%s\"\n", e, buf);
31
32 return e != REG_NOMATCH;
33 }
34
35 #define TEST_FUNCTION do_test ()
36 #include "../test-skeleton.c"
37