X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/0f4556f12c8f75078501c9d1338ae7648a97f975..95f51977ddc18faa2e212f30c00a39540b39f325:/usr/src/ucb/vgrind/regexp.c diff --git a/usr/src/ucb/vgrind/regexp.c b/usr/src/ucb/vgrind/regexp.c index 18f88579ed..84c0505390 100644 --- a/usr/src/ucb/vgrind/regexp.c +++ b/usr/src/ucb/vgrind/regexp.c @@ -1,4 +1,12 @@ -static char sccsid[] = "@(#)regexp.c 4.1 (Berkeley) 10/19/82"; +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef lint +static char sccsid[] = "@(#)regexp.c 5.1 (Berkeley) 6/5/85"; +#endif not lint #include @@ -133,6 +141,7 @@ expconv() /* let the conversion begin */ acs = NIL; + cs = NIL; while (*ure != NIL) { switch (c = *ure++) { @@ -141,7 +150,7 @@ expconv() /* escaped characters are just characters */ default: - if ((*cs & STR) == 0) { + if (cs == NIL || (*cs & STR) == 0) { cs = ccre; *cs = STR; SCNT(cs) = 1; @@ -191,7 +200,8 @@ expconv() /* mark the last match sequence as optional */ case '?': - *cs = *cs | OPT; + if (cs) + *cs = *cs | OPT; break; /* recurse and define a subexpression */ @@ -246,7 +256,7 @@ expconv() /* if its not a metasymbol just build a scharacter string */ default: - if ((*cs & STR) == 0) { + if (cs == NIL || (*cs & STR) == 0) { cs = ccre; *cs = STR; SCNT(cs) = 1;