X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Fread_termcap.c;h=29a9800b188e748f49d1a89575aca0fa5df1ec90;hp=f92ed5d4f83cb9c1bf4fc005dc77345fac411b71;hb=03f728e5bb3630a54fffc4a2ff2f8dbfcce9088e;hpb=d4d1d81ab6fc1ad681ff120d925099f947fefcf3;ds=inline diff --git a/ncurses/tinfo/read_termcap.c b/ncurses/tinfo/read_termcap.c index f92ed5d4..29a9800b 100644 --- a/ncurses/tinfo/read_termcap.c +++ b/ncurses/tinfo/read_termcap.c @@ -56,7 +56,7 @@ #include #include -MODULE_ID("$Id: read_termcap.c,v 1.81 2011/08/07 18:56:35 tom Exp $") +MODULE_ID("$Id: read_termcap.c,v 1.84 2011/09/26 22:52:50 tom Exp $") #if !PURE_TERMINFO @@ -73,7 +73,7 @@ get_termpath(void) if (!use_terminfo_vars() || (result = getenv("TERMPATH")) == 0) result = TERMPATH; - T(("TERMPATH is %s", result)); + TR(TRACE_DATABASE, ("TERMPATH is %s", result)); return result; } @@ -383,7 +383,14 @@ _nc_getent( c = *bp++; if (c == '\n') { lineno++; - if (rp == record || *(rp - 1) != '\\') + /* + * Unlike BSD 4.3, this ignores a backslash at the + * end of a comment-line. That makes it consistent + * with the rest of ncurses -TD + */ + if (rp == record + || *record == '#' + || *(rp - 1) != '\\') break; } *rp++ = c; @@ -702,8 +709,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,7 +786,7 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name) register char *p; register char *cp; char *dummy = NULL; - const char **fname; + CGETENT_CONST char **fname; char *home; int i; char pathbuf[PBUFSIZ]; /* holds raw path of filenames */ @@ -793,7 +798,6 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name) *lineno = 1; fname = pathvec; pvec = pathvec; - tbuf = bp; p = pathbuf; cp = use_terminfo_vars()? getenv("TERMCAP") : NULL; @@ -862,6 +866,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; @@ -941,7 +946,7 @@ add_tc(char *termpaths[], char *path, int count) if (count < MAXPATHS && _nc_access(path, R_OK) == 0) { termpaths[count++] = path; - T(("Adding termpath %s", path)); + TR(TRACE_DATABASE, ("Adding termpath %s", path)); } termpaths[count] = 0; if (save != 0) @@ -965,13 +970,13 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE *const tp) static char *source; static int lineno; - T(("read termcap entry for %s", tn)); + TR(TRACE_DATABASE, ("read termcap entry for %s", tn)); if (strlen(tn) == 0 || strcmp(tn, ".") == 0 || strcmp(tn, "..") == 0 || _nc_pathlast(tn) != 0) { - T(("illegal or missing entry name '%s'", tn)); + TR(TRACE_DATABASE, ("illegal or missing entry name '%s'", tn)); return TGETENT_NO; } @@ -1084,7 +1089,7 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE *const tp) } } if (omit) { - T(("Path %s is a duplicate", termpaths[j])); + TR(TRACE_DATABASE, ("Path %s is a duplicate", termpaths[j])); for (k = j + 1; k < filecount; k++) { termpaths[k - 1] = termpaths[k]; test_stat[k - 1] = test_stat[k]; @@ -1109,7 +1114,7 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE *const tp) for (i = 0; i < filecount; i++) { - T(("Looking for %s in %s", tn, termpaths[i])); + TR(TRACE_DATABASE, ("Looking for %s in %s", tn, termpaths[i])); if (_nc_access(termpaths[i], R_OK) == 0 && (fp = fopen(termpaths[i], "r")) != (FILE *) 0) { _nc_set_source(termpaths[i]);