[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
missing use_terminfo_vars() calls in ncurses-5.1-20001007
From: |
Todd C. Miller |
Subject: |
missing use_terminfo_vars() calls in ncurses-5.1-20001007 |
Date: |
Sun, 08 Oct 2000 16:45:55 -0600 |
This adds a few missing use_terminfo_vars() and fixes up _nc_tgetent().
Previously, _nc_cgetset() would still get called on cp so the
simplest thing is to set cp to NULL if !use_terminfo_vars().
This also makes the code a bit easier to read (IMO). Additionally,
I added checks for a NUL HOME environment variable out of sheer,
raging paranoia.
Personally, I don't like reading .termcap from the cwd since it
could be hostile as well but I have not changed that here. The
same does not seem to be true of the .terminfo dir.
- todd
--- read_termcap.c.DIST Sat Oct 7 21:17:34 2000
+++ read_termcap.c Sun Oct 8 16:35:35 2000
@@ -783,7 +783,7 @@
pvec = pathvec;
tbuf = bp;
p = pathbuf;
- cp = getenv("TERMCAP");
+ cp = use_terminfo_vars() ? getenv("TERMCAP") : NULL;
/*
* TERMCAP can have one of two things in it. It can be the name of a file
@@ -795,23 +795,22 @@
* "$HOME/.termcap /etc/termcap" if no TERMPATH exists.
*/
_nc_str_init(&desc, pathbuf, sizeof(pathbuf));
- if (!is_pathname(cp)) { /* no TERMCAP or it holds an entry */
- if (use_terminfo_vars()
- && (termpath = getenv("TERMPATH")) != 0) {
+ if (cp == NULL) {
+ _nc_safe_strcpy(&desc, "/etc/termcap /usr/share/misc/termcap");
+ } else if (!is_pathname(cp)) { /* TERMCAP holds an entry */
+ if ((termpath = getenv("TERMPATH")) != 0) {
_nc_safe_strcat(&desc, termpath);
} else {
- if (use_terminfo_vars()) {
- char temp[PBUFSIZ];
- temp[0] = 0;
- if ((home = getenv("HOME")) != 0
- && strchr(home, ' ') == 0
- && strlen(home) < sizeof(temp) - 10) { /* setup path */
- sprintf(temp, "%s/", home); /* $HOME first */
- }
- /* if no $HOME look in current directory */
- strcat(temp, ".termcap");
- _nc_safe_strcat(&desc, temp);
+ char temp[PBUFSIZ];
+ temp[0] = 0;
+ if ((home = getenv("HOME")) != 0 && *home != '\0'
+ && strchr(home, ' ') == 0
+ && strlen(home) < sizeof(temp) - 10) { /* setup path */
+ sprintf(temp, "%s/", home); /* $HOME first */
}
+ /* if no $HOME look in current directory */
+ strcat(temp, ".termcap");
+ _nc_safe_strcat(&desc, temp);
_nc_safe_strcat(&desc, " /etc/termcap");
_nc_safe_strcat(&desc, " /usr/share/misc/termcap");
}
@@ -930,7 +929,7 @@
static char *source;
static int lineno;
- if ((p = getenv("TERMCAP")) != 0
+ if (use_terminfo_vars() && (p = getenv("TERMCAP")) != 0
&& !is_pathname(p) && _nc_name_match(p, tn, "|:")) {
/* TERMCAP holds a termcap entry */
strncpy(tc, p, sizeof(tc) - 1);
@@ -980,7 +979,7 @@
char pathbuf[PATH_MAX];
termpaths[filecount] = 0;
- if ((tc = getenv("TERMCAP")) != 0) {
+ if (use_terminfo_vars() && (tc = getenv("TERMCAP")) != 0) {
if (is_pathname(tc)) { /* interpret as a filename */
ADD_TC(tc, 0);
} else if (_nc_name_match(tc, tn, "|:")) { /* treat as a
capability file */
@@ -1013,7 +1012,7 @@
#define PRIVATE_CAP "%s/.termcap"
- if ((h = getenv("HOME")) != NULL
+ if ((h = getenv("HOME")) != NULL && *h != '\0'
&& (strlen(h) + sizeof(PRIVATE_CAP)) < PATH_MAX) {
/* user's .termcap, if any, should override it */
(void) strcpy(envhome, h);
--- read_entry.c.DIST Sat Oct 7 21:17:34 2000
+++ read_entry.c Sun Oct 8 16:23:53 2000
@@ -79,7 +79,7 @@
if (path != 0) {
result = path;
have_tic_directory = TRUE;
- } else if (!have_tic_directory) {
+ } else if (!have_tic_directory && use_terminfo_vars()) {
char *envp;
if ((envp = getenv("TERMINFO")) != 0)
return _nc_tic_dir(envp);
- missing use_terminfo_vars() calls in ncurses-5.1-20001007,
Todd C. Miller <=