]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/read_termcap.c
ncurses 5.9 - patch 20110925
[ncurses.git] / ncurses / tinfo / read_termcap.c
index 700dd77db46e78dd9a6d1ccda134f10063314e48..d4d1869f24efcceabb3ff043b0d95a4da241a08c 100644 (file)
@@ -56,7 +56,7 @@
 #include <sys/types.h>
 #include <tic.h>
 
-MODULE_ID("$Id: read_termcap.c,v 1.79 2011/07/29 00:25:02 tom Exp $")
+MODULE_ID("$Id: read_termcap.c,v 1.82 2011/08/13 00:20:03 tom Exp $")
 
 #if !PURE_TERMINFO
 
@@ -702,8 +702,6 @@ _nc_nfcmp(const char *nf, char *rec)
 #define        PVECSIZ         32      /* max number of names in path */
 #define TBUFSIZ (2048*2)
 
-static char *tbuf;
-
 /*
  * On entry, srcp points to a non ':' character which is the beginning of the
  * token, if any.  We'll try to return a string that doesn't end with a ':'.
@@ -781,18 +779,18 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name)
     register char *p;
     register char *cp;
     char *dummy = NULL;
-    char **fname;
+    CGETENT_CONST char **fname;
     char *home;
     int i;
     char pathbuf[PBUFSIZ];     /* holds raw path of filenames */
-    char *pathvec[PVECSIZ];    /* to point to names in pathbuf */
-    char **pvec;               /* holds usable tail of path vector */
+    CGETENT_CONST char *pathvec[PVECSIZ];      /* point to names in pathbuf */
+    CGETENT_CONST char **pvec; /* holds usable tail of path vector */
     NCURSES_CONST char *termpath;
     string_desc desc;
 
+    *lineno = 1;
     fname = pathvec;
     pvec = pathvec;
-    tbuf = bp;
     p = pathbuf;
     cp = use_terminfo_vars()? getenv("TERMCAP") : NULL;
 
@@ -861,6 +859,7 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name)
      * empty fields, and mistakenly use the last valid cap entry instead of
      * the first (breaks tc= includes)
      */
+    *bp = '\0';
     if (i >= 0) {
        char *pd, *ps, *tok;
        int endflag = FALSE;