null pointer & missing subroutine argument fixes
authorRalph Campbell <ralph@ucbvax.Berkeley.EDU>
Wed, 12 Dec 1984 08:59:38 +0000 (00:59 -0800)
committerRalph Campbell <ralph@ucbvax.Berkeley.EDU>
Wed, 12 Dec 1984 08:59:38 +0000 (00:59 -0800)
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

usr/src/usr.bin/vgrind/regexp.c
usr/src/usr.bin/vgrind/vfontedpr.c
usr/src/usr.bin/vgrind/vgrindefs.c

index 2ddaa9d..8440a75 100644 (file)
@@ -1,4 +1,4 @@
-static char sccsid[] = "@(#)regexp.c   4.1     (Berkeley)      %G%";
+static char sccsid[] = "@(#)regexp.c   4.2     (Berkeley)      %G%";
 
 #include <ctype.h>
 
 
 #include <ctype.h>
 
@@ -133,6 +133,7 @@ expconv()
 
     /* let the conversion begin */
     acs = NIL;
 
     /* let the conversion begin */
     acs = NIL;
+    cs = NIL;
     while (*ure != NIL) {
        switch (c = *ure++) {
 
     while (*ure != NIL) {
        switch (c = *ure++) {
 
@@ -141,7 +142,7 @@ expconv()
 
            /* escaped characters are just characters */
            default:
 
            /* escaped characters are just characters */
            default:
-               if ((*cs & STR) == 0) {
+               if (cs == NIL || (*cs & STR) == 0) {
                    cs = ccre;
                    *cs = STR;
                    SCNT(cs) = 1;
                    cs = ccre;
                    *cs = STR;
                    SCNT(cs) = 1;
@@ -191,7 +192,8 @@ expconv()
 
        /* mark the last match sequence as optional */
        case '?':
 
        /* mark the last match sequence as optional */
        case '?':
-           *cs = *cs | OPT;
+           if (cs)
+               *cs = *cs | OPT;
            break;
 
        /* recurse and define a subexpression */
            break;
 
        /* recurse and define a subexpression */
@@ -246,7 +248,7 @@ expconv()
 
        /* if its not a metasymbol just build a scharacter string */
        default:
 
        /* 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;
                cs = ccre;
                *cs = STR;
                SCNT(cs) = 1;
index 85f8b63..5dce757 100644 (file)
@@ -1,4 +1,4 @@
-static char sccsid[] = "@(#)vfontedpr.c        4.1     (Berkeley)      %G%";
+static char sccsid[] = "@(#)vfontedpr.c        4.2     (Berkeley)      %G%";
 
 #include <ctype.h>
 #include <stdio.h>
 
 #include <ctype.h>
 #include <stdio.h>
@@ -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   *expmatch();            /* match a string to an expression */
 char   *STRNCMP();             /* a different kindof strncmp */
 char   *convexp();             /* convert expression to internal form */
+char   *tgetstr();
 
 boolean        isproc();
 
 
 boolean        isproc();
 
@@ -448,7 +449,7 @@ skip:
                ps("\\c\n'-C\n");
                continue;
            } else {
                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;
            }
                s = s + strlen(s);
                continue;
            }
index a0993c6..3ff396a 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #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 */
 #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 *tbuf;
+static char *filename;
 static int hopcount;   /* detect infinite loops in termcap, init 0 */
 char   *tskip();
 char   *tgetstr();
 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.
  */
  * 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;
 {
        register char *cp;
        register int c;
@@ -47,6 +48,7 @@ tgetent(bp, name, filename)
 
        tbuf = bp;
        tf = 0;
 
        tbuf = bp;
        tf = 0;
+       filename = file;
        tf = open(filename, 0);
        if (tf < 0)
                return (-1);
        tf = open(filename, 0);
        if (tf < 0)
                return (-1);
@@ -121,7 +123,7 @@ tnchktc()
                write(2, "Infinite tc= loop\n", 18);
                return (0);
        }
                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++)
                ;
                return(0);
        for (q=tcbuf; *q != ':'; q++)
                ;