Commit | Line | Data |
---|---|---|
7c9813e1 C |
1 | #include <ctype.h> |
2 | ||
3 | int l_onecase = 0; | |
4 | char * _start; | |
5 | char * _escaped; | |
6 | char * convexp(); | |
7 | char * expmatch(); | |
8 | main() | |
9 | { | |
10 | char reg[132]; | |
11 | char *ireg; | |
12 | char str[132]; | |
13 | char *match; | |
14 | char matstr[132]; | |
15 | char c; | |
16 | ||
17 | while (1) { | |
18 | printf ("\nexpr: "); | |
19 | scanf ("%s", reg); | |
20 | ireg = convexp(reg); | |
21 | match = ireg; | |
22 | while(*match) { | |
23 | switch (*match) { | |
24 | ||
25 | case '\\': | |
26 | case '(': | |
27 | case ')': | |
28 | case '|': | |
29 | printf ("%c", *match); | |
30 | break; | |
31 | ||
32 | default: | |
33 | if (isalnum(*match)) | |
34 | printf("%c", *match); | |
35 | else | |
36 | printf ("<%03o>", *match); | |
37 | break; | |
38 | } | |
39 | match++; | |
40 | } | |
41 | printf("\n"); | |
42 | getchar(); | |
43 | while(1) { | |
44 | printf ("string: "); | |
45 | match = str; | |
46 | while ((c = getchar()) != '\n') | |
47 | *match++ = c; | |
48 | *match = 0; | |
49 | if (str[0] == '#') | |
50 | break; | |
51 | matstr[0] = 0; | |
52 | _start = str; | |
53 | _escaped = 0; | |
54 | match = expmatch (str, ireg, matstr); | |
55 | if (match == 0) | |
56 | printf ("FAILED\n"); | |
57 | else | |
58 | printf ("match\nmatstr = %s\n", matstr); | |
59 | } | |
60 | ||
61 | } | |
62 | } |