better checks for recursion in tc=
authorceriel <none@none>
Tue, 30 Aug 1988 11:37:32 +0000 (11:37 +0000)
committerceriel <none@none>
Tue, 30 Aug 1988 11:37:32 +0000 (11:37 +0000)
lang/cem/libcc/stdio/termcap.c

index 835e50b..2ce9237 100644 (file)
@@ -112,12 +112,17 @@ check_for_tc()
                        return(0);      /* no : in termcap entry */
        if (p[1] != 't' || p[2] != 'c')
                return(1);
-       if (++count > 16) return(0);    /* recursion in tc= definitions */
+       if (count > 16) return(0);      /* recursion in tc= definitions */
+       count++;
        strcpy(terminalname, &p[4]);
        q = terminalname;
        while (*q && *q != ':') q++;
        *q = 0;
-       if (tgetent(buf, terminalname) != 1) return(0);
+       if (tgetent(buf, terminalname) != 1) {
+               ---count;
+               return(0);
+       }
+       --count;
        for (q = buf; *q && *q != ':'; q++) { }
        strcpy(p, q);
        capab = savcapab;