summaryrefslogtreecommitdiff
path: root/lib/libcurses/tinfo
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1999-12-28 23:15:17 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1999-12-28 23:15:17 +0000
commit5b5b8eab120321315d0a50d8a81f42b6ea1ea6ce (patch)
tree023f5d2f292e2e903ca3f8f3ff58a43ac7e7d03c /lib/libcurses/tinfo
parentb7455191930ede0336c3cdc52c67122f76bf0316 (diff)
When reading an entry from terminfo.db, do not try to set a capability
to be 'not present' since that has already been done for us in _nc_init_entry(). This fixes some core dumps caused by a divide by 0 bug deep within ncurses that resulted from using the old way to specify that a capability was 'not present'.
Diffstat (limited to 'lib/libcurses/tinfo')
-rw-r--r--lib/libcurses/tinfo/read_bsd_terminfo.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/lib/libcurses/tinfo/read_bsd_terminfo.c b/lib/libcurses/tinfo/read_bsd_terminfo.c
index ef57727825c..8446b4877c5 100644
--- a/lib/libcurses/tinfo/read_bsd_terminfo.c
+++ b/lib/libcurses/tinfo/read_bsd_terminfo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: read_bsd_terminfo.c,v 1.5 1999/03/02 06:23:29 millert Exp $ */
+/* $OpenBSD: read_bsd_terminfo.c,v 1.6 1999/12/28 23:15:16 millert Exp $ */
/*
* Copyright (c) 1998, 1999 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: read_bsd_terminfo.c,v 1.5 1999/03/02 06:23:29 millert Exp $";
+static char rcsid[] = "$OpenBSD: read_bsd_terminfo.c,v 1.6 1999/12/28 23:15:16 millert Exp $";
#endif
#include <curses.priv.h>
@@ -174,25 +174,16 @@ _nc_lookup_bsd_terminfo_entry(tn, filename, tp)
if (strlen(p) > MAX_ALIAS)
_nc_warning("alias `%s' may be too long", p);
- /* Copy capabilities */
- for_each_boolean(i, tp) {
- if (cgetcap(capbuf, (char *)boolnames[i], ':') == NULL)
- tp->Booleans[i] = FALSE;
- else
+ /* Copy existing capabilities */
+ for_each_boolean(i, tp)
+ if (cgetcap(capbuf, (char *)boolnames[i], ':') != NULL)
tp->Booleans[i] = TRUE;
- }
- for_each_number(i, tp) {
- if (cgetnum(capbuf, (char *)numnames[i], &num) < 0)
- tp->Numbers[i] = 0;
- else
- tp->Numbers[i] = (int)num;
- }
- for_each_string(i, tp) {
- if (cgetstr(capbuf, (char *)strnames[i], &p) < 0)
- tp->Strings[i] = NULL;
- else
+ for_each_number(i, tp)
+ if (cgetnum(capbuf, (char *)numnames[i], &num) == 0)
+ tp->Numbers[i] = (short)num;
+ for_each_string(i, tp)
+ if (cgetstr(capbuf, (char *)strnames[i], &p) >= 0)
tp->Strings[i] = p;
- }
i = 0;
}