]>
Commit | Line | Data |
---|---|---|
1 | #include <mcheck.h> | |
2 | #include <regex.h> | |
3 | #include <stdio.h> | |
4 | #include <stdlib.h> | |
5 | #include <sys/types.h> | |
6 | ||
7 | int | |
8 | main (void) | |
9 | { | |
10 | mtrace (); | |
11 | ||
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 | ||
36 | return res; | |
37 | } |