summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-04-14 19:14:03 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-04-14 19:14:03 +0000
commit4dc960f06da13059f43b9f7a05d8f70b6bc7e2d1 (patch)
tree512817b419a3fa05509faa00de509260c90a23cf /lib
parent752c4b1ab8719d1d2ebcbfe9f567642e08159dbd (diff)
Check $TERMCAP for a termcap entry even when we are using the system's
getcap(3) routines.
Diffstat (limited to 'lib')
-rw-r--r--lib/libcurses/tinfo/read_termcap.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/libcurses/tinfo/read_termcap.c b/lib/libcurses/tinfo/read_termcap.c
index 45d9bb000cb..37fb06dc3a9 100644
--- a/lib/libcurses/tinfo/read_termcap.c
+++ b/lib/libcurses/tinfo/read_termcap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: read_termcap.c,v 1.7 2000/03/26 16:45:04 millert Exp $ */
+/* $OpenBSD: read_termcap.c,v 1.8 2000/04/14 19:14:02 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -921,16 +921,23 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp)
char cwd_buf[PATH_MAX];
#endif
#if USE_GETCAP
- char tc[TBUFSIZ];
+ char *p, tc[TBUFSIZ];
static char *source;
static int lineno;
- /* we're using getcap(3) */
- if (_nc_tgetent(tc, &source, &lineno, tn) < 0)
- return (ERR);
+ if (!issetugid() && (p = getenv("TERMCAP")) != 0 && !is_pathname(p) &&
+ _nc_name_match(p, tn, "|:")) {
- _nc_curr_line = lineno;
- _nc_set_source(source);
+ strlcpy(tc, p, sizeof(tc));
+ _nc_set_source("TERMCAP");
+ } else {
+ /* we're using getcap(3) */
+ if (_nc_tgetent(tc, &source, &lineno, tn) < 0)
+ return (ERR);
+
+ _nc_curr_line = lineno;
+ _nc_set_source(source);
+ }
_nc_read_entry_source((FILE *) 0, tc, FALSE, FALSE, NULLHOOK);
#else
/*