Hurd: opendirat
[glibc.git] / posix / bug-regex31.c
blobfc485815fcf67d82d87edced0ad614db49bde85d
1 #include <mcheck.h>
2 #include <regex.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <sys/types.h>
7 int
8 main (void)
10 mtrace ();
12 int res = 0;
13 char *buf = NULL;
14 size_t len = 0;
15 while (! feof (stdin))
17 ssize_t n = getline (&buf, &len, stdin);
18 if (n <= 0)
19 break;
20 if (buf[n - 1] == '\n')
21 buf[n - 1] = '\0';
23 regex_t regex;
24 int rc = regcomp (&regex, buf, REG_EXTENDED);
25 if (rc != 0)
26 printf ("%s: Error %d (expected)\n", buf, rc);
27 else
29 printf ("%s: succeeded !\n", buf);
30 res = 1;
34 free (buf);
36 return 0;