diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 1996-12-09 01:18:20 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 1996-12-09 01:18:20 +0000 |
commit | 0543de822c7ecd3dc97047c98394d91f2b38a45b (patch) | |
tree | bb7e8e11a27999110febbd997ebdf9e22d6b8a82 /lib/libtermlib/tgetent.c | |
parent | ca1ed7a637526ec8c285954eff0536b7225319e7 (diff) |
Be smarter about running tgetent() multiple times; bump major as we have
a binary incompatibility
Diffstat (limited to 'lib/libtermlib/tgetent.c')
-rw-r--r-- | lib/libtermlib/tgetent.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/libtermlib/tgetent.c b/lib/libtermlib/tgetent.c index e2a5a5e61c6..91a3ea8ddec 100644 --- a/lib/libtermlib/tgetent.c +++ b/lib/libtermlib/tgetent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tgetent.c,v 1.2 1996/07/22 03:13:55 tholo Exp $ */ +/* $OpenBSD: tgetent.c,v 1.3 1996/12/09 01:18:19 tholo Exp $ */ /* * Copyright (c) 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com> @@ -31,10 +31,11 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: tgetent.c,v 1.2 1996/07/22 03:13:55 tholo Exp $"; +static char rcsid[] = "$OpenBSD: tgetent.c,v 1.3 1996/12/09 01:18:19 tholo Exp $"; #endif #include <stdlib.h> +#include <string.h> #include <unistd.h> #include <err.h> #include "term.h" @@ -47,9 +48,15 @@ tgetent(bp, name) char *bp; const char *name; { + char *n; + _ti_buf = bp; - if (cur_term != NULL) + if (cur_term != NULL) { + for (n = strtok(cur_term->names, "|"); n != NULL; n = strtok(NULL, "|")) + if (strcmp(name, n) == 0) + return 1; del_curterm(cur_term); + } if ((cur_term = calloc(sizeof(TERMINAL), 1)) == NULL) errx(1, "No memory for terminal description"); if (isatty(STDOUT_FILENO)) |