xref: /illumos-gate/usr/src/cmd/vgrind/retest.c (revision ddb365bfc9e868ad24ccdcb0dc91af18b10df082)
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 #include <ctype.h>
8 
9 int l_onecase = 0;
10 
11 char	*l_idchars = "_";	/* characters legal in identifiers in addition
12 				   to alphanumerics */
13 
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 }
73