Replace an alloca use with a variable-length array.
[glibc.git] / posix / bug-regex16.c
blob1e41ccb7180ce35ea22aa6ccd068df6a8976a454
1 /* Test re_compile_pattern error messages. */
3 #include <stdio.h>
4 #include <string.h>
5 #include <regex.h>
7 int
8 main (void)
10 struct re_pattern_buffer re;
11 const char *s;
12 int ret = 0;
14 re_set_syntax (RE_SYNTAX_POSIX_EGREP);
15 memset (&re, 0, sizeof (re));
16 s = re_compile_pattern ("[[.invalid_collating_symbol.]]", 30, &re);
17 if (s == NULL || strcmp (s, "Invalid collation character"))
19 printf ("re_compile_pattern returned %s\n", s);
20 ret = 1;
22 s = re_compile_pattern ("[[=invalid_equivalence_class=]]", 31, &re);
23 if (s == NULL || strcmp (s, "Invalid collation character"))
25 printf ("re_compile_pattern returned %s\n", s);
26 ret = 1;
28 s = re_compile_pattern ("[[:invalid_character_class:]]", 29, &re);
29 if (s == NULL || strcmp (s, "Invalid character class name"))
31 printf ("re_compile_pattern returned %s\n", s);
32 ret = 1;
34 return ret;