|
|
1.1 ! root 1: static char sccsid[] = "@(#)retest.c 4.1 (Berkeley) 10/19/82"; ! 2: ! 3: #include <ctype.h> ! 4: ! 5: int l_onecase = 0; ! 6: char * _start; ! 7: char * _escaped; ! 8: char * convexp(); ! 9: char * expmatch(); ! 10: main() ! 11: { ! 12: char reg[132]; ! 13: char *ireg; ! 14: char str[132]; ! 15: char *match; ! 16: char matstr[132]; ! 17: char c; ! 18: ! 19: while (1) { ! 20: printf ("\nexpr: "); ! 21: scanf ("%s", reg); ! 22: ireg = convexp(reg); ! 23: match = ireg; ! 24: while(*match) { ! 25: switch (*match) { ! 26: ! 27: case '\\': ! 28: case '(': ! 29: case ')': ! 30: case '|': ! 31: printf ("%c", *match); ! 32: break; ! 33: ! 34: default: ! 35: if (isalnum(*match)) ! 36: printf("%c", *match); ! 37: else ! 38: printf ("<%03o>", *match); ! 39: break; ! 40: } ! 41: match++; ! 42: } ! 43: printf("\n"); ! 44: getchar(); ! 45: while(1) { ! 46: printf ("string: "); ! 47: match = str; ! 48: while ((c = getchar()) != '\n') ! 49: *match++ = c; ! 50: *match = 0; ! 51: if (str[0] == '#') ! 52: break; ! 53: matstr[0] = 0; ! 54: _start = str; ! 55: _escaped = 0; ! 56: match = expmatch (str, ireg, matstr); ! 57: if (match == 0) ! 58: printf ("FAILED\n"); ! 59: else ! 60: printf ("match\nmatstr = %s\n", matstr); ! 61: } ! 62: ! 63: } ! 64: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.