summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1999-03-11 21:03:59 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1999-03-11 21:03:59 +0000
commit73a856115702157d58128365662b9519d7daeadc (patch)
tree6ff9a5f980b684e623391e394e48c512c960ced4
parent62849813a43735aeaa89e531a24138e11c68b595 (diff)
ncurses-4.2-990307
-rw-r--r--lib/libcurses/base/lib_getch.c12
-rw-r--r--lib/libcurses/base/lib_newterm.c14
-rw-r--r--lib/libcurses/base/lib_set_term.c8
-rw-r--r--lib/libcurses/base/lib_slk.c28
-rw-r--r--lib/libcurses/base/lib_slkclear.c14
-rw-r--r--lib/libcurses/base/lib_slkrefr.c15
-rw-r--r--lib/libcurses/tinfo/comp_expand.c40
-rw-r--r--lib/libcurses/tinfo/lib_raw.c12
-rw-r--r--lib/libcurses/tinfo/name_match.c67
-rw-r--r--lib/libcurses/tinfo/write_entry.c6
-rw-r--r--lib/libcurses/trace/trace_tries.c12
11 files changed, 133 insertions, 95 deletions
diff --git a/lib/libcurses/base/lib_getch.c b/lib/libcurses/base/lib_getch.c
index e4b65e62ff8..65d314e1907 100644
--- a/lib/libcurses/base/lib_getch.c
+++ b/lib/libcurses/base/lib_getch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_getch.c,v 1.1 1999/01/18 19:09:46 millert Exp $ */
+/* $OpenBSD: lib_getch.c,v 1.2 1999/03/11 21:03:55 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -42,7 +42,7 @@
#include <curses.priv.h>
-MODULE_ID("$From: lib_getch.c,v 1.41 1998/09/26 23:34:53 tom Exp $")
+MODULE_ID("$From: lib_getch.c,v 1.43 1999/03/08 02:35:10 tom Exp $")
#include <fifo_defs.h>
@@ -231,8 +231,9 @@ int ch;
if (wgetch_should_refresh(win))
wrefresh(win);
- if (!win->_notimeout && (win->_delay >= 0 || SP->_cbreak > 1)) {
- int delay;
+ if (!win->_notimeout && (win->_delay >= 0 || SP->_cbreak > 1))
+ {
+ int delay;
T(("timed delay in wgetch()"));
if (SP->_cbreak > 1)
@@ -248,7 +249,8 @@ int ch;
/* else go on to read data available */
}
- if (win->_use_keypad) {
+ if (win->_use_keypad)
+ {
/*
* This is tricky. We only want to get special-key
* events one at a time. But we want to accumulate
diff --git a/lib/libcurses/base/lib_newterm.c b/lib/libcurses/base/lib_newterm.c
index 6218dfa32a2..ad9819fe8dc 100644
--- a/lib/libcurses/base/lib_newterm.c
+++ b/lib/libcurses/base/lib_newterm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_newterm.c,v 1.2 1999/01/31 20:17:09 millert Exp $ */
+/* $OpenBSD: lib_newterm.c,v 1.3 1999/03/11 21:03:55 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -50,7 +50,7 @@
#include <term.h> /* clear_screen, cup & friends, cur_term */
-MODULE_ID("$From: lib_newterm.c,v 1.38 1999/01/31 01:23:25 tom Exp $")
+MODULE_ID("$From: lib_newterm.c,v 1.39 1999/03/03 23:44:22 juergen Exp $")
#ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */
#define ONLCR 0
@@ -96,6 +96,7 @@ void filter(void)
SCREEN * newterm(NCURSES_CONST char *term, FILE *ofp, FILE *ifp)
{
int errret;
+int slk_format = _nc_slk_format;
SCREEN* current;
#ifdef TRACE
int t = _nc_getenv_num("NCURSES_TRACE");
@@ -150,10 +151,11 @@ int t = _nc_getenv_num("NCURSES_TRACE");
We assume that we must simulate, if it is none of the standard
formats (4-4 or 3-2-3) for which there may be some hardware
support. */
- if (num_labels <= 0 || !SLK_STDFMT)
- if (_nc_slk_format)
+ if (num_labels <= 0 || !SLK_STDFMT(slk_format))
+ if (slk_format)
{
- if (ERR==_nc_ripoffline(-SLK_LINES, _nc_slk_initialize))
+ if (ERR==_nc_ripoffline(-SLK_LINES(slk_format),
+ _nc_slk_initialize))
return 0;
}
/* this actually allocates the screen structure, and saves the
@@ -167,7 +169,7 @@ int t = _nc_getenv_num("NCURSES_TRACE");
}
/* if the terminal type has real soft labels, set those up */
- if (_nc_slk_format && num_labels > 0 && SLK_STDFMT)
+ if (slk_format && num_labels > 0 && SLK_STDFMT(slk_format))
_nc_slk_initialize(stdscr, COLS);
SP->_ifd = fileno(ifp);
diff --git a/lib/libcurses/base/lib_set_term.c b/lib/libcurses/base/lib_set_term.c
index 3dcf382d002..63a3dd87bed 100644
--- a/lib/libcurses/base/lib_set_term.c
+++ b/lib/libcurses/base/lib_set_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_set_term.c,v 1.2 1999/02/24 06:31:08 millert Exp $ */
+/* $OpenBSD: lib_set_term.c,v 1.3 1999/03/11 21:03:55 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -33,8 +33,6 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
-
/*
** lib_set_term.c
**
@@ -46,7 +44,7 @@
#include <term.h> /* cur_term */
-MODULE_ID("$From: lib_set_term.c,v 1.44 1999/02/18 11:31:47 tom Exp $")
+MODULE_ID("$From: lib_set_term.c,v 1.45 1999/03/06 22:29:13 tom Exp $")
SCREEN * set_term(SCREEN *screen)
{
@@ -161,7 +159,7 @@ size_t i;
SP->_curscol = -1;
SP->_nl = TRUE;
SP->_raw = FALSE;
- SP->_cbreak = FALSE;
+ SP->_cbreak = 0;
SP->_echo = TRUE;
SP->_fifohead = -1;
SP->_endwin = TRUE;
diff --git a/lib/libcurses/base/lib_slk.c b/lib/libcurses/base/lib_slk.c
index 9605d61d9ed..76ba38d65dd 100644
--- a/lib/libcurses/base/lib_slk.c
+++ b/lib/libcurses/base/lib_slk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_slk.c,v 1.1 1999/01/18 19:09:59 millert Exp $ */
+/* $OpenBSD: lib_slk.c,v 1.2 1999/03/11 21:03:55 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -43,7 +43,7 @@
#include <ctype.h>
#include <term.h> /* num_labels, label_*, plab_norm */
-MODULE_ID("$From: lib_slk.c,v 1.15 1999/01/02 22:56:30 tom Exp $")
+MODULE_ID("$From: lib_slk.c,v 1.16 1999/03/03 23:44:22 juergen Exp $")
/*
* We'd like to move these into the screen context structure, but cannot,
@@ -58,7 +58,7 @@ int _nc_slk_format; /* one more than format specified in slk_init() */
static void
slk_paint_info(WINDOW *win)
{
- if (win && _nc_slk_format==4)
+ if (win && SP->slk_format==4)
{
int i;
@@ -66,7 +66,7 @@ slk_paint_info(WINDOW *win)
wmove (win,0,0);
for (i = 0; i < SP->_slk->maxlab; i++) {
- if (win && _nc_slk_format==4)
+ if (win && SP->slk_format==4)
{
mvwaddch(win,0,SP->_slk->ent[i].x,'F');
if (i<9)
@@ -89,6 +89,7 @@ int
_nc_slk_initialize(WINDOW *stwin, int cols)
{
int i, x;
+int res = OK;
char *p;
T(("slk_initialize()"));
@@ -105,9 +106,12 @@ char *p;
SP->_slk->buffer = NULL;
SP->_slk->attr = A_STANDOUT;
- SP->_slk->maxlab = (num_labels > 0) ? num_labels : MAX_SKEY;
- SP->_slk->maxlen = (num_labels > 0) ? label_width * label_height : MAX_SKEY_LEN;
- SP->_slk->labcnt = (SP->_slk->maxlab < MAX_SKEY) ? MAX_SKEY : SP->_slk->maxlab;
+ SP->_slk->maxlab = (num_labels > 0) ?
+ num_labels : MAX_SKEY(_nc_slk_format);
+ SP->_slk->maxlen = (num_labels > 0) ?
+ label_width * label_height : MAX_SKEY_LEN(_nc_slk_format);
+ SP->_slk->labcnt = (SP->_slk->maxlab < MAX_SKEY(_nc_slk_format)) ?
+ MAX_SKEY(_nc_slk_format) : SP->_slk->maxlab;
SP->_slk->ent = typeCalloc(slk_ent, SP->_slk->labcnt);
if (SP->_slk->ent == NULL)
@@ -179,11 +183,17 @@ char *p;
FreeIfNeeded(SP->_slk->ent);
free(SP->_slk);
SP->_slk = (SLK*)0;
- return(ERR);
+ res = (ERR);
}
}
- return(OK);
+ /* We now reset the format so that the next newterm has again
+ * per default no SLK keys and may call slk_init again to
+ * define a new layout. (juergen 03-Mar-1999)
+ */
+ SP->slk_format = _nc_slk_format;
+ _nc_slk_format = 0;
+ return(res);
}
diff --git a/lib/libcurses/base/lib_slkclear.c b/lib/libcurses/base/lib_slkclear.c
index aa28feda10b..eef57c72fd4 100644
--- a/lib/libcurses/base/lib_slkclear.c
+++ b/lib/libcurses/base/lib_slkclear.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_slkclear.c,v 1.1 1999/01/18 19:10:01 millert Exp $ */
+/* $OpenBSD: lib_slkclear.c,v 1.2 1999/03/11 21:03:56 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -40,7 +40,7 @@
*/
#include <curses.priv.h>
-MODULE_ID("$From: lib_slkclear.c,v 1.3 1998/02/11 12:13:56 tom Exp $")
+MODULE_ID("$From: lib_slkclear.c,v 1.4 1999/03/03 23:44:22 juergen Exp $")
int
slk_clear(void)
@@ -54,7 +54,11 @@ slk_clear(void)
inherit those attributes from the standard screen */
SP->_slk->win->_bkgd = stdscr->_bkgd;
SP->_slk->win->_attrs = stdscr->_attrs;
- werase(SP->_slk->win);
-
- returnCode(wrefresh(SP->_slk->win));
+ if (SP->_slk->win == stdscr) {
+ returnCode(OK);
+ }
+ else {
+ werase(SP->_slk->win);
+ returnCode(wrefresh(SP->_slk->win));
+ }
}
diff --git a/lib/libcurses/base/lib_slkrefr.c b/lib/libcurses/base/lib_slkrefr.c
index ab3df3b391e..5c3e7d944d9 100644
--- a/lib/libcurses/base/lib_slkrefr.c
+++ b/lib/libcurses/base/lib_slkrefr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_slkrefr.c,v 1.1 1999/01/18 19:10:03 millert Exp $ */
+/* $OpenBSD: lib_slkrefr.c,v 1.2 1999/03/11 21:03:56 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -40,7 +40,7 @@
#include <curses.priv.h>
#include <term.h> /* num_labels, label_*, plab_norm */
-MODULE_ID("$From: lib_slkrefr.c,v 1.6 1999/01/02 22:56:59 tom Exp $")
+MODULE_ID("$From: lib_slkrefr.c,v 1.7 1999/03/03 23:44:22 juergen Exp $")
/*
* Write the soft labels to the soft-key window.
@@ -49,22 +49,25 @@ static void
slk_intern_refresh(SLK *slk)
{
int i;
+int fmt = SP->slk_format;
+
for (i = 0; i < slk->labcnt; i++) {
if (slk->dirty || slk->ent[i].dirty) {
if (slk->ent[i].visible) {
- if (num_labels > 0 && SLK_STDFMT)
+ if (num_labels > 0 && SLK_STDFMT(fmt))
{
if (i < num_labels) {
TPUTS_TRACE("plab_norm");
- putp(tparm(plab_norm, i, slk->win,slk->ent[i].form_text));
+ putp(tparm(plab_norm, i+1, slk->win,slk->ent[i].form_text));
}
}
else
{
- wmove(slk->win,SLK_LINES-1,slk->ent[i].x);
+ wmove(slk->win,SLK_LINES(fmt)-1,slk->ent[i].x);
if (SP && SP->_slk)
wattrset(slk->win,SP->_slk->attr);
- waddnstr(slk->win,slk->ent[i].form_text, MAX_SKEY_LEN);
+ waddnstr(slk->win,slk->ent[i].form_text,
+ MAX_SKEY_LEN(fmt));
/* if we simulate SLK's, it's looking much more
natural to use the current ATTRIBUTE also
for the label window */
diff --git a/lib/libcurses/tinfo/comp_expand.c b/lib/libcurses/tinfo/comp_expand.c
index c78ec3c117e..bf2bb3d397d 100644
--- a/lib/libcurses/tinfo/comp_expand.c
+++ b/lib/libcurses/tinfo/comp_expand.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: comp_expand.c,v 1.2 1999/03/02 06:23:28 millert Exp $ */
+/* $OpenBSD: comp_expand.c,v 1.3 1999/03/11 21:03:57 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -37,7 +37,7 @@
#include <ctype.h>
#include <tic.h>
-MODULE_ID("$From: comp_expand.c,v 1.10 1999/02/23 23:14:59 tom Exp $")
+MODULE_ID("$From: comp_expand.c,v 1.11 1999/03/07 00:51:07 tom Exp $")
static int trailing_spaces(const char *src)
{
@@ -51,7 +51,7 @@ static int trailing_spaces(const char *src)
#define REALCTL(s) (CHAR_OF(s) < 127 && iscntrl(CHAR_OF(s)))
#define REALPRINT(s) (CHAR_OF(s) < 127 && isprint(CHAR_OF(s)))
-char *_nc_tic_expand(const char *srcp, bool tic_format, bool numbers)
+char *_nc_tic_expand(const char *srcp, bool tic_format, int numbers)
{
static char * buffer;
static size_t length;
@@ -75,18 +75,21 @@ int ch;
/*
* Though the character literals are more compact, most
* terminal descriptions use numbers and are not easy
- * to read in character-literal form. This is the
- * default option for tic/infocmp.
+ * to read in character-literal form.
*/
- if (numbers
- && str[0] == S_QUOTE
- && str[1] != '\\'
- && REALPRINT(str+1)
- && str[2] == S_QUOTE) {
+ switch (numbers) {
+ case -1:
+ if (str[0] == S_QUOTE
+ && str[1] != '\\'
+ && REALPRINT(str+1)
+ && str[2] == S_QUOTE) {
sprintf(buffer+bufp, "{%d}", str[1]);
bufp += strlen(buffer+bufp);
str += 2;
- }
+ } else {
+ buffer[bufp++] = *str;
+ }
+ break;
/*
* If we have a "%{number}", try to translate it into
* a "%'char'" form, since that will run a little faster
@@ -94,9 +97,9 @@ int ch;
* for the constant makes it simpler to compare terminal
* descriptions.
*/
- else if (!numbers
- && str[0] == L_BRACE
- && isdigit(str[1])) {
+ case 1:
+ if (str[0] == L_BRACE
+ && isdigit(str[1])) {
char *dst = 0;
long value = strtol(str+1, &dst, 0);
if (dst != 0
@@ -115,8 +118,13 @@ int ch;
} else {
buffer[bufp++] = *str;
}
- } else {
- buffer[bufp++] = *str;
+ } else {
+ buffer[bufp++] = *str;
+ }
+ break;
+ default:
+ buffer[bufp++] = *str;
+ break;
}
}
else if (ch == 128) {
diff --git a/lib/libcurses/tinfo/lib_raw.c b/lib/libcurses/tinfo/lib_raw.c
index a9280a57edb..fc414144c3a 100644
--- a/lib/libcurses/tinfo/lib_raw.c
+++ b/lib/libcurses/tinfo/lib_raw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_raw.c,v 1.1 1999/01/18 19:10:19 millert Exp $ */
+/* $OpenBSD: lib_raw.c,v 1.2 1999/03/11 21:03:57 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -51,7 +51,7 @@
#include <curses.priv.h>
#include <term.h> /* cur_term */
-MODULE_ID("$From: lib_raw.c,v 1.2 1998/12/20 00:42:58 tom Exp $")
+MODULE_ID("$From: lib_raw.c,v 1.3 1999/03/06 22:28:24 tom Exp $")
#if defined(SVR4_TERMIO) && !defined(_POSIX_SOURCE)
#define _POSIX_SOURCE
@@ -82,7 +82,7 @@ int raw(void)
if (SP != 0 && cur_term != 0) {
SP->_raw = TRUE;
- SP->_cbreak = TRUE;
+ SP->_cbreak = 1;
#ifdef __EMX__
setmode(SP->_ifd, O_BINARY);
@@ -107,7 +107,7 @@ int cbreak(void)
{
T((T_CALLED("cbreak()")));
- SP->_cbreak = TRUE;
+ SP->_cbreak = 1;
#ifdef __EMX__
setmode(SP->_ifd, O_BINARY);
@@ -151,7 +151,7 @@ int noraw(void)
T((T_CALLED("noraw()")));
SP->_raw = FALSE;
- SP->_cbreak = FALSE;
+ SP->_cbreak = 0;
#ifdef __EMX__
setmode(SP->_ifd, O_TEXT);
@@ -173,7 +173,7 @@ int nocbreak(void)
{
T((T_CALLED("nocbreak()")));
- SP->_cbreak = FALSE;
+ SP->_cbreak = 0;
#ifdef __EMX__
setmode(SP->_ifd, O_TEXT);
diff --git a/lib/libcurses/tinfo/name_match.c b/lib/libcurses/tinfo/name_match.c
index 814e780a4d4..77099d601be 100644
--- a/lib/libcurses/tinfo/name_match.c
+++ b/lib/libcurses/tinfo/name_match.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: name_match.c,v 1.1 1999/01/18 19:10:21 millert Exp $ */
+/* $OpenBSD: name_match.c,v 1.2 1999/03/11 21:03:57 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1999 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,15 +29,14 @@
****************************************************************************/
/****************************************************************************
- * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
- * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * Author: Thomas E. Dickey <dickey@clark.net> 1999 *
****************************************************************************/
#include <curses.priv.h>
#include <term.h>
#include <tic.h>
-MODULE_ID("$From: name_match.c,v 1.7 1998/09/19 20:27:49 Todd.Miller Exp $")
+MODULE_ID("$From: name_match.c,v 1.8 1999/03/07 01:58:36 tom Exp $")
/*
* _nc_first_name(char *names)
@@ -48,16 +47,16 @@ MODULE_ID("$From: name_match.c,v 1.7 1998/09/19 20:27:49 Todd.Miller Exp $")
char *_nc_first_name(const char *const sp)
/* get the first name from the given name list */
{
- static char buf[MAX_NAME_SIZE+1];
- register char *cp;
+ static char buf[MAX_NAME_SIZE+1];
+ register unsigned n;
- (void) strlcpy(buf, sp, sizeof(buf));
-
- cp = strchr(buf, '|');
- if (cp)
- *cp = '\0';
-
- return(buf);
+ for (n = 0; n < sizeof(buf)-1; n++) {
+ if ((buf[n] = sp[n]) == '\0'
+ || (buf[n] == '|'))
+ break;
+ }
+ buf[n] = '\0';
+ return(buf);
}
/*
@@ -67,21 +66,33 @@ char *_nc_first_name(const char *const sp)
*/
int _nc_name_match(const char *const namelst, const char *const name, const char *const delim)
-/* microtune this, it occurs in several critical loops */
{
-char namecopy[MAX_ENTRY_SIZE]; /* this may get called on a TERMCAP value */
-register char *cp;
+ const char *s, *d, *t;
+ int code, found;
- if (namelst == 0)
- return(FALSE);
- (void) strlcpy (namecopy, namelst, sizeof(namecopy));
- if ((cp = strtok(namecopy, delim)) != 0) {
- do {
- /* avoid strcmp() function-call cost if possible */
- if (cp[0] == name[0] && strcmp(cp, name) == 0)
- return(TRUE);
- } while
- ((cp = strtok((char *)0, delim)) != 0);
+ if ((s = namelst) != 0) {
+ while (*s != '\0') {
+ for (d = name; *d != '\0'; d++) {
+ if (*s != *d)
+ break;
+ s++;
+ }
+ found = FALSE;
+ for (code = TRUE; *s != '\0'; code = FALSE, s++) {
+ for (t = delim; *t != '\0'; t++) {
+ if (*s == *t) {
+ found = TRUE;
+ break;
+ }
+ }
+ if (found)
+ break;
+ }
+ if (code && *d == '\0')
+ return code;
+ if (*s++ == 0)
+ break;
+ }
}
- return(FALSE);
+ return FALSE;
}
diff --git a/lib/libcurses/tinfo/write_entry.c b/lib/libcurses/tinfo/write_entry.c
index a085849b491..9ca111ce5c2 100644
--- a/lib/libcurses/tinfo/write_entry.c
+++ b/lib/libcurses/tinfo/write_entry.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: write_entry.c,v 1.2 1999/03/02 06:23:29 millert Exp $ */
+/* $OpenBSD: write_entry.c,v 1.3 1999/03/11 21:03:57 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -56,7 +56,7 @@
#define TRACE_OUT(p) /*nothing*/
#endif
-MODULE_ID("$From: write_entry.c,v 1.45 1999/02/28 22:26:33 tom Exp $")
+MODULE_ID("$From: write_entry.c,v 1.46 1999/03/06 22:48:21 tom Exp $")
static int total_written;
@@ -379,7 +379,7 @@ static int compute_offsets(char **Strings, int strmax, short *offsets)
return nextfree;
}
-static void convert_shorts(char *buf, short *Numbers, int count)
+static void convert_shorts(unsigned char *buf, short *Numbers, int count)
{
int i;
for (i = 0; i < count; i++) {
diff --git a/lib/libcurses/trace/trace_tries.c b/lib/libcurses/trace/trace_tries.c
index 2951c3ba0d3..effb7378d6c 100644
--- a/lib/libcurses/trace/trace_tries.c
+++ b/lib/libcurses/trace/trace_tries.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trace_tries.c,v 1.2 1999/03/02 06:23:30 millert Exp $ */
+/* $OpenBSD: trace_tries.c,v 1.3 1999/03/11 21:03:58 millert Exp $ */
/****************************************************************************
* Copyright (c) 1999 Free Software Foundation, Inc. *
@@ -37,23 +37,23 @@
#include <curses.priv.h>
-MODULE_ID("$From: trace_tries.c,v 1.5 1999/02/28 23:42:28 tom Exp $")
+MODULE_ID("$From: trace_tries.c,v 1.6 1999/03/06 22:51:07 tom Exp $")
#ifdef TRACE
-static char *buffer;
+static unsigned char *buffer;
static unsigned len;
static void recur_tries(struct tries *tree, unsigned level)
{
if (level > len)
- buffer = (char *)realloc(buffer, len = (level + 1) * 4);
+ buffer = (unsigned char *)realloc(buffer, len = (level + 1) * 4);
while (tree != 0) {
if ((buffer[level] = tree->ch) == 0)
buffer[level] = 128;
buffer[level+1] = 0;
if (tree->value != 0) {
- _tracef("%5d: %s (%s)", tree->value, _nc_visbuf(buffer), keyname(tree->value));
+ _tracef("%5d: %s (%s)", tree->value, _nc_visbuf((char *)buffer), keyname(tree->value));
}
if (tree->child)
recur_tries(tree->child, level+1);
@@ -63,7 +63,7 @@ static void recur_tries(struct tries *tree, unsigned level)
void _nc_trace_tries(struct tries *tree)
{
- buffer = typeMalloc(char, len = 80);
+ buffer = typeMalloc(unsigned char, len = 80);
_tracef("BEGIN tries %p", tree);
recur_tries(tree, 0);
_tracef(". . . tries %p", tree);