summaryrefslogtreecommitdiff
path: root/lib/libocurses/termcap.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-11-19 17:07:15 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-11-19 17:07:15 +0000
commit0885c03cfe9a392b561d73290f6baa72dccafb01 (patch)
tree856ce7f384dd9ded04201deb8f0e421a82061aa7 /lib/libocurses/termcap.c
parent7b793c6e257abc5246751209b956720c8d7adb2a (diff)
For issetugid case, only ignore $TERMCAP if it is a path
Diffstat (limited to 'lib/libocurses/termcap.c')
-rw-r--r--lib/libocurses/termcap.c63
1 files changed, 31 insertions, 32 deletions
diff --git a/lib/libocurses/termcap.c b/lib/libocurses/termcap.c
index 0f55e14ba75..004efe7ed53 100644
--- a/lib/libocurses/termcap.c
+++ b/lib/libocurses/termcap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: termcap.c,v 1.3 1998/11/04 21:21:24 millert Exp $ */
+/* $OpenBSD: termcap.c,v 1.4 1998/11/19 17:07:14 millert Exp $ */
/* $NetBSD: termcap.c,v 1.7 1995/06/05 19:45:52 pk Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)termcap.c 8.1 (Berkeley) 6/4/93";
#else
-static char rcsid[] = "$OpenBSD: termcap.c,v 1.3 1998/11/04 21:21:24 millert Exp $";
+static char rcsid[] = "$OpenBSD: termcap.c,v 1.4 1998/11/19 17:07:14 millert Exp $";
#endif
#endif /* not lint */
@@ -92,39 +92,38 @@ tgetent(bp, name)
pvec = pathvec;
tbuf = bp;
- if (!issetugid()) {
- cp = getenv("TERMCAP");
- /*
- * TERMCAP can have one of two things in it. It can be the name
- * of a file to use instead of /usr/share/misc/termcap. In this
- * case it better start with a "/". Or it can be an entry to
- * use so we don't have to read the file. In this case it
- * has to already have the newlines crunched out. If TERMCAP
- * does not hold a file name then a path of names is searched
- * instead. The path is found in the TERMPATH variable, or
- * becomes "$HOME/.termcap /usr/share/misc/termcap" if no
- * TERMPATH exists.
- */
- if (!cp || *cp != '/') { /* no TERMCAP or it holds an entry */
- if ((termpath = getenv("TERMPATH")) != NULL)
- strlcpy(pathbuf, termpath, sizeof(pathbuf));
- else {
- if ((home = getenv("HOME")) != NULL &&
- strlen(home) + sizeof(_PATH_DEF) <
- sizeof(pathbuf)) {
- sprintf(pathbuf, "%s/%s", home,
- _PATH_DEF);
- } else {
- strlcpy(pathbuf, _PATH_DEF,
- sizeof(pathbuf));
- }
+ cp = getenv("TERMCAP");
+ /*
+ * TERMCAP can have one of two things in it. It can be the name
+ * of a file to use instead of /usr/share/misc/termcap. In this
+ * case it better start with a "/". Or it can be an entry to use
+ * so we don't have to read the file. In this case it has to
+ * already have the newlines crunched out. If TERMCAP does not
+ * hold a file name then a path of names is searched instead.
+ * The path is found in the TERMPATH variable, or becomes
+ * "$HOME/.termcap /usr/share/misc/termcap" if no TERMPATH exists.
+ */
+ if (issetugid()) {
+ strlcpy(pathbuf, _PATH_TERMCAP, sizeof(pathbuf));
+ } else if (!cp || *cp != '/') { /* no TERMCAP or it holds an entry */
+ if ((termpath = getenv("TERMPATH")) != NULL)
+ strlcpy(pathbuf, termpath, sizeof(pathbuf));
+ else {
+ if ((home = getenv("HOME")) != NULL &&
+ strlen(home) + sizeof(_PATH_DEF) <
+ sizeof(pathbuf)) {
+ sprintf(pathbuf, "%s/%s", home,
+ _PATH_DEF);
+ } else {
+ strlcpy(pathbuf, _PATH_DEF,
+ sizeof(pathbuf));
}
- } else { /* user-defined path in TERMCAP */
- /* still can be tokenized */
- strlcpy(pathbuf, cp, sizeof(pathbuf));
}
- *fname++ = pathbuf; /* tokenize path into vector of names */
+ } else { /* user-defined path in TERMCAP */
+ /* still can be tokenized */
+ strlcpy(pathbuf, cp, sizeof(pathbuf));
}
+ *fname++ = pathbuf; /* tokenize path into vector of names */
/* split pathbuf into a vector of paths */
p = pathbuf;