diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2000-04-04 16:50:00 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2000-04-04 16:50:00 +0000 |
commit | cd4585dd9084ad0cd879289b1968f8a2a5c96143 (patch) | |
tree | 815bcb27776ed8cfe64e0cdbf0585e8c2ad51e0d /lib/libcurses | |
parent | eb922e28e48261b2a0d7e98202d5b72426f0b73c (diff) |
Update to ncurses-5.0-20000401:
o change unctrl() to render C1 characters (128-159) as ~@, ~A, etc.
o trace() function is provided only if TRACE is defined, e.g., in the debug
library. Modify related calls to _tracechar() to use unctrl() instead.
Diffstat (limited to 'lib/libcurses')
-rw-r--r-- | lib/libcurses/base/MKunctrl.awk | 6 | ||||
-rw-r--r-- | lib/libcurses/curses.h | 4 | ||||
-rw-r--r-- | lib/libcurses/tinfo/captoinfo.c | 8 | ||||
-rw-r--r-- | lib/libcurses/tinfo/comp_scan.c | 14 | ||||
-rw-r--r-- | lib/libcurses/trace/lib_trace.c | 16 | ||||
-rw-r--r-- | lib/libcurses/trace/lib_tracechr.c | 24 |
6 files changed, 30 insertions, 42 deletions
diff --git a/lib/libcurses/base/MKunctrl.awk b/lib/libcurses/base/MKunctrl.awk index b3e05a3dd39..2084622303c 100644 --- a/lib/libcurses/base/MKunctrl.awk +++ b/lib/libcurses/base/MKunctrl.awk @@ -1,5 +1,5 @@ -# $OpenBSD: MKunctrl.awk,v 1.1 1999/01/18 19:09:32 millert Exp $ -# $From: MKunctrl.awk,v 1.6 1998/06/06 18:18:07 tom Exp $ +# $OpenBSD: MKunctrl.awk,v 1.2 2000/04/04 16:49:59 millert Exp $ +# $From: MKunctrl.awk,v 1.7 2000/04/01 19:49:26 tom Exp $ ############################################################################## # Copyright (c) 1998 Free Software Foundation, Inc. # # # @@ -51,6 +51,8 @@ END { printf "\"^\\%03o\"", ch + 64 } else if (ch == 127) { printf "\"^?\"" + } else if (ch >= 128 && ch < 160) { + printf "\"~\\%03o\"", ch - 64 } else { printf "\"\\%03o\"", ch gap = gap " " diff --git a/lib/libcurses/curses.h b/lib/libcurses/curses.h index 99a3783cda8..9b009f27796 100644 --- a/lib/libcurses/curses.h +++ b/lib/libcurses/curses.h @@ -1,4 +1,4 @@ -/* $OpenBSD: curses.h,v 1.49 2000/03/26 16:45:02 millert Exp $ */ +/* $OpenBSD: curses.h,v 1.50 2000/04/04 16:49:58 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -50,7 +50,7 @@ /* These are defined only in curses.h, and are used for conditional compiles */ #define NCURSES_VERSION_MAJOR 5 #define NCURSES_VERSION_MINOR 0 -#define NCURSES_VERSION_PATCH 20000325 +#define NCURSES_VERSION_PATCH 20000401 /* This is defined in more than one ncurses header, for identification */ #undef NCURSES_VERSION diff --git a/lib/libcurses/tinfo/captoinfo.c b/lib/libcurses/tinfo/captoinfo.c index 8d29df29720..2a797d038e5 100644 --- a/lib/libcurses/tinfo/captoinfo.c +++ b/lib/libcurses/tinfo/captoinfo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: captoinfo.c,v 1.7 2000/03/26 16:45:03 millert Exp $ */ +/* $OpenBSD: captoinfo.c,v 1.8 2000/04/04 16:49:59 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -94,7 +94,7 @@ #include <ctype.h> #include <tic.h> -MODULE_ID("$From: captoinfo.c,v 1.36 2000/03/19 23:04:26 tom Exp $") +MODULE_ID("$From: captoinfo.c,v 1.37 2000/04/01 20:07:34 tom Exp $") #define MAX_PUSHED 16 /* max # args we can push onto the stack */ @@ -462,8 +462,8 @@ _nc_captoinfo( invalid: dp = save_char(dp, '%'); s--; - _nc_warning("unknown %% code %s in %s", - _tracechar(*s), cap); + _nc_warning("unknown %% code %s (%#x) in %s", + unctrl(*s), (*s) & 0xff, cap); break; } break; diff --git a/lib/libcurses/tinfo/comp_scan.c b/lib/libcurses/tinfo/comp_scan.c index 0b23157bc8b..d2b7b78ecb8 100644 --- a/lib/libcurses/tinfo/comp_scan.c +++ b/lib/libcurses/tinfo/comp_scan.c @@ -50,7 +50,7 @@ #include <term_entry.h> #include <tic.h> -MODULE_ID("$From: comp_scan.c,v 1.41 2000/03/25 17:25:33 tom Exp $") +MODULE_ID("$From: comp_scan.c,v 1.42 2000/04/01 19:08:36 tom Exp $") /* * Maximum length of string capability we'll accept before raising an error. @@ -196,7 +196,7 @@ _nc_get_token(void) #endif && !strchr(terminfo_punct, (char) ch)) { _nc_warning("Illegal character (expected alphanumeric or %s) - %s", - terminfo_punct, _tracechar((chtype) ch)); + terminfo_punct, unctrl(ch)); _nc_panic_mode(separator); goto start_token; } @@ -331,7 +331,7 @@ _nc_get_token(void) case '@': if ((ch = next_char()) != separator) _nc_warning("Missing separator after `%s', have %s", - buffer, _tracechar((chtype) ch)); + buffer, unctrl(ch)); _nc_curr_token.tk_name = buffer; type = CANCEL; break; @@ -369,8 +369,7 @@ _nc_get_token(void) default: /* just to get rid of the compiler warning */ type = UNDEF; - _nc_warning("Illegal character - %s", - _tracechar((chtype) ch)); + _nc_warning("Illegal character - %s", unctrl(ch)); } } /* end else (first_column == FALSE) */ } /* end else (ch != EOF) */ @@ -469,8 +468,7 @@ _nc_trans_string(char *ptr, char *last) _nc_err_abort("Premature EOF"); if (!(is7bits(ch) && isprint(ch))) { - _nc_warning("Illegal ^ character - %s", - _tracechar((unsigned char) ch)); + _nc_warning("Illegal ^ character - %s", unctrl(ch)); } if (ch == '?') { *(ptr++) = '\177'; @@ -564,7 +562,7 @@ _nc_trans_string(char *ptr, char *last) default: _nc_warning("Illegal character %s in \\ sequence", - _tracechar((unsigned char) ch)); + unctrl(ch)); *(ptr++) = (char) ch; } /* endswitch (ch) */ } /* endelse (ch < '0' || ch > '7') */ diff --git a/lib/libcurses/trace/lib_trace.c b/lib/libcurses/trace/lib_trace.c index 141d7030c19..0eab5abfb93 100644 --- a/lib/libcurses/trace/lib_trace.c +++ b/lib/libcurses/trace/lib_trace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_trace.c,v 1.4 2000/03/10 01:35:05 millert Exp $ */ +/* $OpenBSD: lib_trace.c,v 1.5 2000/04/04 16:49:59 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -42,7 +42,7 @@ #include <ctype.h> -MODULE_ID("$From: lib_trace.c,v 1.33 2000/02/13 01:01:55 tom Exp $") +MODULE_ID("$From: lib_trace.c,v 1.34 2000/04/01 20:25:47 tom Exp $") unsigned _nc_tracing = 0; /* always define this */ @@ -51,12 +51,10 @@ const char *_nc_tputs_trace = ""; long _nc_outchars = 0; static FILE *tracefp; /* default to writing to stderr */ -#endif void trace(const unsigned int tracelevel GCC_UNUSED) { -#ifdef TRACE static bool been_here = FALSE; static char my_name[] = "trace"; @@ -81,8 +79,8 @@ trace(const unsigned int tracelevel GCC_UNUSED) _tracef("TRACING NCURSES version %s (%d)", NCURSES_VERSION, NCURSES_VERSION_PATCH); } -#endif } +#endif const char * _nc_visbuf2(int bufnum, const char *buf) @@ -97,7 +95,15 @@ _nc_visbuf2(int bufnum, const char *buf) if (buf == CANCELLED_STRING) return ("(cancelled)"); +#ifdef TRACE tp = vbuf = _nc_trace_buf(bufnum, (strlen(buf) * 4) + 5); +#else + { + static char *mybuf[2]; + mybuf[bufnum] = _nc_doalloc(mybuf[bufnum], (strlen(buf) * 4) + 5); + tp = vbuf = mybuf[bufnum]; + } +#endif *tp++ = '"'; while ((c = *buf++) != '\0') { if (c == '"') { diff --git a/lib/libcurses/trace/lib_tracechr.c b/lib/libcurses/trace/lib_tracechr.c index e97e6793146..932ee8d811d 100644 --- a/lib/libcurses/trace/lib_tracechr.c +++ b/lib/libcurses/trace/lib_tracechr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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 * @@ -31,36 +31,18 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - - /* * lib_tracechr.c - Tracing/Debugging routines */ - -#ifndef TRACE -#define TRACE /* turn on internal defs for this module */ -#endif - #include <curses.priv.h> -#include <ctype.h> +MODULE_ID("$From: lib_tracechr.c,v 1.2 2000/04/01 20:17:26 tom Exp $") #ifdef TRACE char *_tracechar(const unsigned char ch) { static char crep[20]; - /* - * We can show the actual character if it's either an ordinary printable - * or one of the high-half characters. - */ - if (isprint(ch) || (ch & 0x80)) - { - crep[0] = '\''; - crep[1] = ch; /* necessary; printf tries too hard on metachars */ - (void) sprintf(crep + 2, "' = 0x%02x", (unsigned)ch); - } - else - (void) sprintf(crep, "0x%02x", (unsigned)ch); + (void) sprintf(crep, "'%s' = 0x%02x", unctrl(ch), (unsigned)ch); return(crep); } #else |