]>
Commit | Line | Data |
---|---|---|
ef06edbe UD |
1 | #include <mcheck.h> |
2 | #include <regex.h> | |
3 | #include <stdio.h> | |
5615eaf2 | 4 | #include <stdlib.h> |
ef06edbe UD |
5 | #include <sys/types.h> |
6 | ||
e9b9cbf5 UD |
7 | int |
8 | main (void) | |
ef06edbe | 9 | { |
ef06edbe UD |
10 | mtrace (); |
11 | ||
e9b9cbf5 UD |
12 | int res = 0; |
13 | char *buf = NULL; | |
14 | size_t len = 0; | |
15 | while (! feof (stdin)) | |
16 | { | |
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'; | |
22 | ||
23 | regex_t regex; | |
24 | int rc = regcomp (®ex, buf, REG_EXTENDED); | |
25 | if (rc != 0) | |
26 | printf ("%s: Error %d (expected)\n", buf, rc); | |
27 | else | |
28 | { | |
29 | printf ("%s: succeeded !\n", buf); | |
30 | res = 1; | |
31 | } | |
32 | } | |
33 | ||
34 | free (buf); | |
35 | ||
bde2667a | 36 | return res; |
ef06edbe | 37 | } |