Back to index

glibc  2.9
bug-regex16.c
Go to the documentation of this file.
00001 /* Test re_compile_pattern error messages.  */
00002 
00003 #include <stdio.h>
00004 #include <string.h>
00005 #include <regex.h>
00006 
00007 int
00008 main (void)
00009 {
00010   struct re_pattern_buffer re;
00011   const char *s;
00012   int ret = 0;
00013 
00014   re_set_syntax (RE_SYNTAX_POSIX_EGREP);
00015   memset (&re, 0, sizeof (re));
00016   s = re_compile_pattern ("[[.invalid_collating_symbol.]]", 30, &re);
00017   if (s == NULL || strcmp (s, "Invalid collation character"))
00018     {
00019       printf ("re_compile_pattern returned %s\n", s);
00020       ret = 1;
00021     }
00022   s = re_compile_pattern ("[[=invalid_equivalence_class=]]", 31, &re);
00023   if (s == NULL || strcmp (s, "Invalid collation character"))
00024     {
00025       printf ("re_compile_pattern returned %s\n", s);
00026       ret = 1;
00027     }
00028   s = re_compile_pattern ("[[:invalid_character_class:]]", 29, &re);
00029   if (s == NULL || strcmp (s, "Invalid character class name"))
00030     {
00031       printf ("re_compile_pattern returned %s\n", s);
00032       ret = 1;
00033     }
00034   return ret;
00035 }