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