From: Ralph Campbell Date: Wed, 12 Dec 1984 08:59:38 +0000 (-0800) Subject: null pointer & missing subroutine argument fixes X-Git-Tag: BSD-4_3-Snapshot-Development~9204 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/1a8c1b812dcf4f875e62bd2e12cb28c881304e8f null pointer & missing subroutine argument fixes SCCS-vsn: usr.bin/vgrind/regexp.c 4.2 SCCS-vsn: usr.bin/vgrind/vgrindefs.c 4.3 SCCS-vsn: usr.bin/vgrind/vfontedpr.c 4.2 --- diff --git a/usr/src/usr.bin/vgrind/regexp.c b/usr/src/usr.bin/vgrind/regexp.c index 2ddaa9d34c..8440a75cf0 100644 --- a/usr/src/usr.bin/vgrind/regexp.c +++ b/usr/src/usr.bin/vgrind/regexp.c @@ -1,4 +1,4 @@ -static char sccsid[] = "@(#)regexp.c 4.1 (Berkeley) %G%"; +static char sccsid[] = "@(#)regexp.c 4.2 (Berkeley) %G%"; #include @@ -133,6 +133,7 @@ expconv() /* let the conversion begin */ acs = NIL; + cs = NIL; while (*ure != NIL) { switch (c = *ure++) { @@ -141,7 +142,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 +192,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 +248,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; diff --git a/usr/src/usr.bin/vgrind/vfontedpr.c b/usr/src/usr.bin/vgrind/vfontedpr.c index 85f8b6356d..5dce7570b8 100644 --- a/usr/src/usr.bin/vgrind/vfontedpr.c +++ b/usr/src/usr.bin/vgrind/vfontedpr.c @@ -1,4 +1,4 @@ -static char sccsid[] = "@(#)vfontedpr.c 4.1 (Berkeley) %G%"; +static char sccsid[] = "@(#)vfontedpr.c 4.2 (Berkeley) %G%"; #include #include @@ -28,6 +28,7 @@ static char sccsid[] = "@(#)vfontedpr.c 4.1 (Berkeley) %G%"; char *expmatch(); /* match a string to an expression */ char *STRNCMP(); /* a different kindof strncmp */ char *convexp(); /* convert expression to internal form */ +char *tgetstr(); boolean isproc(); @@ -448,7 +449,7 @@ skip: ps("\\c\n'-C\n"); continue; } else { - putKcp (s, s + strlen(s) -1); + putKcp (s, s + strlen(s) -1, TRUE); s = s + strlen(s); continue; } diff --git a/usr/src/usr.bin/vgrind/vgrindefs.c b/usr/src/usr.bin/vgrind/vgrindefs.c index a0993c6315..3ff396a8cb 100644 --- a/usr/src/usr.bin/vgrind/vgrindefs.c +++ b/usr/src/usr.bin/vgrind/vgrindefs.c @@ -1,5 +1,5 @@ #ifndef lint -static char sccsid[] = "@(#)vgrindefs.c 4.2 (Berkeley) %G%"; +static char sccsid[] = "@(#)vgrindefs.c 4.3 (Berkeley) %G%"; #endif /* Copyright (c) 1979 Regents of the University of California */ @@ -24,6 +24,7 @@ static char sccsid[] = "@(#)vgrindefs.c 4.2 (Berkeley) %G%"; */ static char *tbuf; +static char *filename; static int hopcount; /* detect infinite loops in termcap, init 0 */ char *tskip(); char *tgetstr(); @@ -35,8 +36,8 @@ char *getenv(); * from the termcap file. Parse is very rudimentary; * we just notice escaped newlines. */ -tgetent(bp, name, filename) - char *bp, *name, *filename; +tgetent(bp, name, file) + char *bp, *name, *file; { register char *cp; register int c; @@ -47,6 +48,7 @@ tgetent(bp, name, filename) tbuf = bp; tf = 0; + filename = file; tf = open(filename, 0); if (tf < 0) return (-1); @@ -121,7 +123,7 @@ tnchktc() write(2, "Infinite tc= loop\n", 18); return (0); } - if (tgetent(tcbuf, tcname) != 1) + if (tgetent(tcbuf, tcname, filename) != 1) return(0); for (q=tcbuf; *q != ':'; q++) ;