122064Sdist /* 2*62422Sbostic * Copyright (c) 1980, 1993 3*62422Sbostic * The Regents of the University of California. All rights reserved. 436167Sbostic * 542696Sbostic * %sccs.include.redist.c% 622064Sdist */ 78661Smckusick 822064Sdist #ifndef lint 9*62422Sbostic static char copyright[] = 10*62422Sbostic "@(#) Copyright (c) 1980, 1993\n\ 11*62422Sbostic The Regents of the University of California. All rights reserved.\n"; 1236167Sbostic #endif /* not lint */ 1322064Sdist 1436167Sbostic #ifndef lint 15*62422Sbostic static char sccsid[] = "@(#)retest.c 8.1 (Berkeley) 06/06/93"; 1636167Sbostic #endif /* not lint */ 1736167Sbostic 188661Smckusick #include <ctype.h> 198661Smckusick 208661Smckusick int l_onecase = 0; 218661Smckusick char * _start; 228661Smckusick char * _escaped; 238661Smckusick char * convexp(); 248661Smckusick char * expmatch(); main()258661Smckusickmain() 268661Smckusick { 278661Smckusick char reg[132]; 288661Smckusick char *ireg; 298661Smckusick char str[132]; 308661Smckusick char *match; 318661Smckusick char matstr[132]; 328661Smckusick char c; 338661Smckusick 348661Smckusick while (1) { 358661Smckusick printf ("\nexpr: "); 368661Smckusick scanf ("%s", reg); 378661Smckusick ireg = convexp(reg); 388661Smckusick match = ireg; 398661Smckusick while(*match) { 408661Smckusick switch (*match) { 418661Smckusick 428661Smckusick case '\\': 438661Smckusick case '(': 448661Smckusick case ')': 458661Smckusick case '|': 468661Smckusick printf ("%c", *match); 478661Smckusick break; 488661Smckusick 498661Smckusick default: 508661Smckusick if (isalnum(*match)) 518661Smckusick printf("%c", *match); 528661Smckusick else 538661Smckusick printf ("<%03o>", *match); 548661Smckusick break; 558661Smckusick } 568661Smckusick match++; 578661Smckusick } 588661Smckusick printf("\n"); 598661Smckusick getchar(); 608661Smckusick while(1) { 618661Smckusick printf ("string: "); 628661Smckusick match = str; 638661Smckusick while ((c = getchar()) != '\n') 648661Smckusick *match++ = c; 658661Smckusick *match = 0; 668661Smckusick if (str[0] == '#') 678661Smckusick break; 688661Smckusick matstr[0] = 0; 698661Smckusick _start = str; 708661Smckusick _escaped = 0; 718661Smckusick match = expmatch (str, ireg, matstr); 728661Smckusick if (match == 0) 738661Smckusick printf ("FAILED\n"); 748661Smckusick else 758661Smckusick printf ("match\nmatstr = %s\n", matstr); 768661Smckusick } 778661Smckusick 788661Smckusick } 798661Smckusick } 80