1 | // BZ 12811 |
---|---|
2 | #include <regex.h> |
3 | #include <stdio.h> |
4 | #include <locale.h> |
5 | |
6 | static int |
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 (s: "setlocale failed"); |
14 | return 1; |
15 | } |
16 | |
17 | int e = regcomp (preg: &preg, pattern: ".*ab", REG_ICASE); |
18 | if (e != 0) |
19 | { |
20 | regerror (errcode: e, preg: &preg, errbuf: buf, errbuf_size: sizeof (buf)); |
21 | printf (format: "regcomp = %d \"%s\"\n", e, buf); |
22 | return 1; |
23 | } |
24 | |
25 | // Incomplete character at the end of the buffer |
26 | e = regexec (preg: &preg, String: "aaaaaaaaaaaa\xc4", nmatch: 0, NULL, eflags: 0); |
27 | |
28 | regfree (preg: &preg); |
29 | regerror (errcode: e, preg: &preg, errbuf: buf, errbuf_size: sizeof (buf)); |
30 | printf (format: "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 |