summaryrefslogtreecommitdiff
path: root/lib/libcurses/tries.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-01-17 16:27:39 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-01-17 16:27:39 +0000
commitfc75df79b339ce5f679b6cdb5395378328fd8510 (patch)
tree6e79365e27ab3167f64f5e6b6a7767a06ba19580 /lib/libcurses/tries.c
parent5af16d68f427511a7d63fc23f6e315c81674d436 (diff)
Use _ti_get_screensize() from libtermlib to update screen size if changed
after a program is suspended. Define EXTERN_TERMINFO in curses.h. Update to ncurses-4.1-980103 and crank minor.
Diffstat (limited to 'lib/libcurses/tries.c')
-rw-r--r--lib/libcurses/tries.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/libcurses/tries.c b/lib/libcurses/tries.c
index a93e59fa983..92090efc5d4 100644
--- a/lib/libcurses/tries.c
+++ b/lib/libcurses/tries.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tries.c,v 1.1 1997/12/03 05:21:45 millert Exp $ */
+/* $OpenBSD: tries.c,v 1.2 1998/01/17 16:27:38 millert Exp $ */
/******************************************************************************
* Copyright 1997 by Thomas E. Dickey <dickey@clark.net> *
@@ -29,9 +29,10 @@
#include <curses.priv.h>
-MODULE_ID("Id: tries.c,v 1.5 1997/10/26 21:55:15 tom Exp $")
+MODULE_ID("Id: tries.c,v 1.6 1997/12/28 00:15:04 tom Exp $")
#define SET_TRY(dst,src) if ((dst->ch = *src++) == 128) dst->ch = '\0'
+#define CMP_TRY(a,b) ((a)? (a == b) : (b == 128))
void _nc_add_to_try(struct tries **tree, char *str, unsigned short code)
{
@@ -39,7 +40,7 @@ void _nc_add_to_try(struct tries **tree, char *str, unsigned short code)
struct tries *ptr, *savedptr;
unsigned char *txt = (unsigned char *)str;
- if (txt == 0 || out_of_memory || code == 0)
+ if (txt == 0 || *txt == '\0' || out_of_memory || code == 0)
return;
if ((*tree) != 0) {
@@ -48,11 +49,11 @@ void _nc_add_to_try(struct tries **tree, char *str, unsigned short code)
for (;;) {
unsigned char cmp = *txt;
- while (ptr->ch != cmp
+ while (!CMP_TRY(ptr->ch, cmp)
&& ptr->sibling != 0)
ptr = ptr->sibling;
- if (ptr->ch == cmp) {
+ if (CMP_TRY(ptr->ch, cmp)) {
if (*(++txt) == '\0') {
ptr->value = code;
return;