Annotation of 43BSDReno/pgrm/vgrind/retest/retest.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1980 The Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * Redistribution and use in source and binary forms are permitted
                      6:  * provided that: (1) source distributions retain this entire copyright
                      7:  * notice and comment, and (2) distributions including binaries display
                      8:  * the following acknowledgement:  ``This product includes software
                      9:  * developed by the University of California, Berkeley and its contributors''
                     10:  * in the documentation or other materials provided with the distribution
                     11:  * and in all advertising materials mentioning features or use of this
                     12:  * software. Neither the name of the University nor the names of its
                     13:  * contributors may be used to endorse or promote products derived
                     14:  * from this software without specific prior written permission.
                     15:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
                     16:  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
                     17:  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     18:  */
                     19: 
                     20: #ifndef lint
                     21: char copyright[] =
                     22: "@(#) Copyright (c) 1980 The Regents of the University of California.\n\
                     23:  All rights reserved.\n";
                     24: #endif /* not lint */
                     25: 
                     26: #ifndef lint
                     27: static char sccsid[] = "@(#)retest.c   5.3 (Berkeley) 6/1/90";
                     28: #endif /* not lint */
                     29: 
                     30: #include <ctype.h>
                     31: 
                     32: int l_onecase = 0;
                     33: char * _start;
                     34: char * _escaped;
                     35: char * convexp();
                     36: char * expmatch();
                     37: main()
                     38: {
                     39:     char reg[132];
                     40:     char *ireg;
                     41:     char str[132];
                     42:     char *match;
                     43:     char matstr[132];
                     44:     char c;
                     45: 
                     46:     while (1) {
                     47:        printf ("\nexpr: ");
                     48:        scanf ("%s", reg);
                     49:        ireg = convexp(reg);
                     50:        match = ireg;
                     51:        while(*match) {
                     52:            switch (*match) {
                     53: 
                     54:            case '\\':
                     55:            case '(':
                     56:            case ')':
                     57:            case '|':
                     58:                printf ("%c", *match);
                     59:                break;
                     60: 
                     61:            default:
                     62:                if (isalnum(*match))
                     63:                    printf("%c", *match);
                     64:                else
                     65:                    printf ("<%03o>", *match);
                     66:                break;
                     67:            }
                     68:            match++;
                     69:        }
                     70:        printf("\n");
                     71:        getchar();
                     72:        while(1) {
                     73:            printf ("string: ");
                     74:            match = str;
                     75:            while ((c = getchar()) != '\n')
                     76:                *match++ = c;
                     77:            *match = 0;
                     78:            if (str[0] == '#')
                     79:                break;
                     80:            matstr[0] = 0;
                     81:            _start = str;
                     82:            _escaped = 0;
                     83:            match = expmatch (str, ireg, matstr);
                     84:            if (match == 0)
                     85:                printf ("FAILED\n");
                     86:            else
                     87:                printf ("match\nmatstr = %s\n", matstr);
                     88:        }
                     89: 
                     90:     }
                     91: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.