xref: /titanic_50/usr/src/cmd/vgrind/retest.c (revision f8919bdadda3ebb97bd55cc14a16e0271ed57615)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
8 	  /* from UCB 5.1 (Berkeley) 6/5/85 */
9 
10 #include <ctype.h>
11 
12 int l_onecase = 0;
13 
14 char	*l_idchars = "_";	/* characters legal in identifiers in addition
15 				   to alphanumerics */
16 
17 char * Start;
18 char * _escaped;
19 char * convexp();
20 char * expmatch();
21 main()
22 {
23     char reg[132];
24     char *ireg;
25     char str[132];
26     char *match;
27     char matstr[132];
28     char c;
29 
30     while (1) {
31 	printf ("\nexpr: ");
32 	scanf ("%s", reg);
33 	ireg = convexp(reg);
34 	match = ireg;
35 	while(*match) {
36 	    switch (*match) {
37 
38 	    case '\\':
39 	    case '(':
40 	    case ')':
41 	    case '|':
42 		printf ("%c", *match);
43 		break;
44 
45 	    default:
46 		if (isalnum(*match))
47 		    printf("%c", *match);
48 		else
49 		    printf ("<%03o>", *match);
50 		break;
51 	    }
52 	    match++;
53 	}
54 	printf("\n");
55 	getchar();
56 	while(1) {
57 	    printf ("string: ");
58 	    match = str;
59 	    while ((c = getchar()) != '\n')
60 		*match++ = c;
61 	    *match = 0;
62 	    if (str[0] == '#')
63 		break;
64 	    matstr[0] = 0;
65 	    Start = str;
66 	    _escaped = 0;
67 	    match = expmatch (str, ireg, matstr);
68 	    if (match == 0)
69 		printf ("FAILED\n");
70 	    else
71 		printf ("match\nmatstr = %s\n", matstr);
72 	}
73 
74     }
75 }
76