11590Srgrimes/* 21590Srgrimes * Copyright (c) 1980, 1993 31590Srgrimes * The Regents of the University of California. All rights reserved. 41590Srgrimes * 51590Srgrimes * Redistribution and use in source and binary forms, with or without 61590Srgrimes * modification, are permitted provided that the following conditions 71590Srgrimes * are met: 81590Srgrimes * 1. Redistributions of source code must retain the above copyright 91590Srgrimes * notice, this list of conditions and the following disclaimer. 101590Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111590Srgrimes * notice, this list of conditions and the following disclaimer in the 121590Srgrimes * documentation and/or other materials provided with the distribution. 131590Srgrimes * 4. Neither the name of the University nor the names of its contributors 141590Srgrimes * may be used to endorse or promote products derived from this software 151590Srgrimes * without specific prior written permission. 161590Srgrimes * 171590Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 181590Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 191590Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 201590Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 211590Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 221590Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 231590Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 241590Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 251590Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 261590Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 271590Srgrimes * SUCH DAMAGE. 28216370Sjoel * 29216370Sjoel * $FreeBSD: releng/10.2/usr.bin/vgrind/RETEST/retest.c 216370 2010-12-11 08:32:16Z joel $ 301590Srgrimes */ 311590Srgrimes 321590Srgrimes#ifndef lint 331590Srgrimesstatic char copyright[] = 341590Srgrimes"@(#) Copyright (c) 1980, 1993\n\ 351590Srgrimes The Regents of the University of California. All rights reserved.\n"; 361590Srgrimes#endif /* not lint */ 371590Srgrimes 381590Srgrimes#ifndef lint 391590Srgrimesstatic char sccsid[] = "@(#)retest.c 8.1 (Berkeley) 6/6/93"; 401590Srgrimes#endif /* not lint */ 411590Srgrimes 421590Srgrimes#include <ctype.h> 431590Srgrimes 441590Srgrimesint l_onecase = 0; 451590Srgrimeschar * _start; 461590Srgrimeschar * _escaped; 471590Srgrimeschar * convexp(); 481590Srgrimeschar * expmatch(); 491590Srgrimesmain() 501590Srgrimes{ 511590Srgrimes char reg[132]; 521590Srgrimes char *ireg; 531590Srgrimes char str[132]; 541590Srgrimes char *match; 551590Srgrimes char matstr[132]; 561590Srgrimes char c; 571590Srgrimes 581590Srgrimes while (1) { 591590Srgrimes printf ("\nexpr: "); 601590Srgrimes scanf ("%s", reg); 611590Srgrimes ireg = convexp(reg); 621590Srgrimes match = ireg; 631590Srgrimes while(*match) { 641590Srgrimes switch (*match) { 651590Srgrimes 661590Srgrimes case '\\': 671590Srgrimes case '(': 681590Srgrimes case ')': 691590Srgrimes case '|': 701590Srgrimes printf ("%c", *match); 711590Srgrimes break; 721590Srgrimes 731590Srgrimes default: 741590Srgrimes if (isalnum(*match)) 751590Srgrimes printf("%c", *match); 761590Srgrimes else 771590Srgrimes printf ("<%03o>", *match); 781590Srgrimes break; 791590Srgrimes } 801590Srgrimes match++; 811590Srgrimes } 821590Srgrimes printf("\n"); 831590Srgrimes getchar(); 841590Srgrimes while(1) { 851590Srgrimes printf ("string: "); 861590Srgrimes match = str; 871590Srgrimes while ((c = getchar()) != '\n') 881590Srgrimes *match++ = c; 891590Srgrimes *match = 0; 901590Srgrimes if (str[0] == '#') 911590Srgrimes break; 921590Srgrimes matstr[0] = 0; 931590Srgrimes _start = str; 941590Srgrimes _escaped = 0; 951590Srgrimes match = expmatch (str, ireg, matstr); 961590Srgrimes if (match == 0) 971590Srgrimes printf ("FAILED\n"); 981590Srgrimes else 991590Srgrimes printf ("match\nmatstr = %s\n", matstr); 1001590Srgrimes } 1011590Srgrimes 1021590Srgrimes } 1031590Srgrimes} 104