summaryrefslogtreecommitdiff
path: root/lib/libcurses/trace
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-04-04 16:50:00 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-04-04 16:50:00 +0000
commitcd4585dd9084ad0cd879289b1968f8a2a5c96143 (patch)
tree815bcb27776ed8cfe64e0cdbf0585e8c2ad51e0d /lib/libcurses/trace
parenteb922e28e48261b2a0d7e98202d5b72426f0b73c (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/trace')
-rw-r--r--lib/libcurses/trace/lib_trace.c16
-rw-r--r--lib/libcurses/trace/lib_tracechr.c24
2 files changed, 14 insertions, 26 deletions
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