diff --git a/ncurses/trace/README b/ncurses/trace/README
new file mode 100644
index 0000000..e658fec
--- /dev/null
+++ b/ncurses/trace/README
@@ -0,0 +1,33 @@
+-------------------------------------------------------------------------------
+-- Copyright (c) 1998,2006 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             --
+-- "Software"), to deal in the Software without restriction, including       --
+-- without limitation the rights to use, copy, modify, merge, publish,       --
+-- distribute, distribute with modifications, sublicense, and/or sell copies --
+-- of the Software, and to permit persons to whom the Software is furnished  --
+-- to do so, subject to the following conditions:                            --
+--                                                                           --
+-- The above copyright notice and this permission notice shall be included   --
+-- in all copies or substantial portions of the Software.                    --
+--                                                                           --
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS   --
+-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF                --
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN --
+-- NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,       --
+-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR     --
+-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE --
+-- USE OR OTHER DEALINGS IN THE SOFTWARE.                                    --
+--                                                                           --
+-- Except as contained in this notice, the name(s) of the above copyright    --
+-- holders shall not be used in advertising or otherwise to promote the      --
+-- sale, use or other dealings in this Software without prior written        --
+-- authorization.                                                            --
+-------------------------------------------------------------------------------
+-- $Id: README,v 1.2 2006/04/22 22:19:37 tom Exp $
+-------------------------------------------------------------------------------
+
+The files in this directory (trace) support both the terminfo and ncurses
+libraries.  Most of the functions are linked in only when the libraries
+are compiled with TRACE defined.
diff --git a/ncurses/trace/lib_trace.c b/ncurses/trace/lib_trace.c
new file mode 100644
index 0000000..743b1f6
--- /dev/null
+++ b/ncurses/trace/lib_trace.c
@@ -0,0 +1,334 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+/*
+ *	lib_trace.c - Tracing/Debugging routines
+ *
+ * The _tracef() function is originally from pcurses (by Pavel Curtis) in 1982. 
+ * pcurses allowed one to enable/disable tracing using traceon() and traceoff()
+ * functions.  ncurses provides a trace() function which allows one to
+ * selectively enable or disable several tracing features.
+ */
+
+#include <curses.priv.h>
+#include <tic.h>
+
+#include <ctype.h>
+
+MODULE_ID("$Id: lib_trace.c,v 1.71 2008/08/23 18:04:29 tom Exp $")
+
+NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */
+
+#ifdef TRACE
+
+#if USE_REENTRANT
+NCURSES_EXPORT(const char *)
+NCURSES_PUBLIC_VAR(_nc_tputs_trace) (void)
+{
+    return SP ? SP->_tputs_trace : _nc_prescreen._tputs_trace;
+}
+NCURSES_EXPORT(long)
+NCURSES_PUBLIC_VAR(_nc_outchars) (void)
+{
+    return SP ? SP->_outchars : _nc_prescreen._outchars;
+}
+NCURSES_EXPORT(void)
+_nc_set_tputs_trace(const char *s)
+{
+    if (SP)
+	SP->_tputs_trace = s;
+    else
+	_nc_prescreen._tputs_trace = s;
+}
+NCURSES_EXPORT(void)
+_nc_count_outchars(long increment)
+{
+    if (SP)
+	SP->_outchars += increment;
+    else
+	_nc_prescreen._outchars += increment;
+}
+#else
+NCURSES_EXPORT_VAR(const char *) _nc_tputs_trace = "";
+NCURSES_EXPORT_VAR(long) _nc_outchars = 0;
+#endif
+
+#define TraceFP		_nc_globals.trace_fp
+#define TracePath	_nc_globals.trace_fname
+#define TraceLevel	_nc_globals.trace_level
+
+NCURSES_EXPORT(void)
+trace(const unsigned int tracelevel)
+{
+    if ((TraceFP == 0) && tracelevel) {
+	const char *mode = _nc_globals.init_trace ? "ab" : "wb";
+
+	if (TracePath[0] == '\0') {
+	    int size = sizeof(TracePath) - 12;
+	    if (getcwd(TracePath, size) == 0) {
+		perror("curses: Can't get working directory");
+		exit(EXIT_FAILURE);
+	    }
+	    TracePath[size] = '\0';
+	    assert(strlen(TracePath) <= size);
+	    strcat(TracePath, "/trace");
+	    if (_nc_is_dir_path(TracePath)) {
+		strcat(TracePath, ".log");
+	    }
+	}
+
+	_nc_globals.init_trace = TRUE;
+	_nc_tracing = tracelevel;
+	if (_nc_access(TracePath, W_OK) < 0
+	    || (TraceFP = fopen(TracePath, mode)) == 0) {
+	    perror("curses: Can't open 'trace' file");
+	    exit(EXIT_FAILURE);
+	}
+	/* Try to set line-buffered mode, or (failing that) unbuffered,
+	 * so that the trace-output gets flushed automatically at the
+	 * end of each line.  This is useful in case the program dies. 
+	 */
+#if HAVE_SETVBUF		/* ANSI */
+	(void) setvbuf(TraceFP, (char *) 0, _IOLBF, 0);
+#elif HAVE_SETBUF		/* POSIX */
+	(void) setbuffer(TraceFP, (char *) 0);
+#endif
+	_tracef("TRACING NCURSES version %s.%d (tracelevel=%#x)",
+		NCURSES_VERSION,
+		NCURSES_VERSION_PATCH,
+		tracelevel);
+    } else if (tracelevel == 0) {
+	if (TraceFP != 0) {
+	    fclose(TraceFP);
+	    TraceFP = 0;
+	}
+	_nc_tracing = tracelevel;
+    } else if (_nc_tracing != tracelevel) {
+	_nc_tracing = tracelevel;
+	_tracef("tracelevel=%#x", tracelevel);
+    }
+}
+
+static void
+_nc_va_tracef(const char *fmt, va_list ap)
+{
+    static const char Called[] = T_CALLED("");
+    static const char Return[] = T_RETURN("");
+
+    bool before = FALSE;
+    bool after = FALSE;
+    unsigned doit = _nc_tracing;
+    int save_err = errno;
+
+    if (strlen(fmt) >= sizeof(Called) - 1) {
+	if (!strncmp(fmt, Called, sizeof(Called) - 1)) {
+	    before = TRUE;
+	    TraceLevel++;
+	} else if (!strncmp(fmt, Return, sizeof(Return) - 1)) {
+	    after = TRUE;
+	}
+	if (before || after) {
+	    if ((TraceLevel <= 1)
+		|| (doit & TRACE_ICALLS) != 0)
+		doit &= (TRACE_CALLS | TRACE_CCALLS);
+	    else
+		doit = 0;
+	}
+    }
+
+    if (doit != 0) {
+	if (TraceFP == 0)
+	    TraceFP = stderr;
+#ifdef USE_PTHREADS
+	/*
+	 * TRACE_ICALLS is "really" needed to show normal use with threaded
+	 * applications, since anything can be running during a napms(),
+	 * making it appear in the hierarchical trace as it other functions
+	 * are being called.
+	 *
+	 * Rather than add the complication of a per-thread stack, just
+	 * show the thread-id in each line of the trace.
+	 */
+# if USE_WEAK_SYMBOLS
+	if ((pthread_self))
+# endif
+	    fprintf(TraceFP, "%#lx:", (long) (void *) pthread_self());
+#endif
+	if (before || after) {
+	    int n;
+	    for (n = 1; n < TraceLevel; n++)
+		fputs("+ ", TraceFP);
+	}
+	vfprintf(TraceFP, fmt, ap);
+	fputc('\n', TraceFP);
+	fflush(TraceFP);
+    }
+
+    if (after && TraceLevel)
+	TraceLevel--;
+
+    errno = save_err;
+}
+
+NCURSES_EXPORT(void)
+_tracef(const char *fmt,...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    _nc_va_tracef(fmt, ap);
+    va_end(ap);
+}
+
+/* Trace 'bool' return-values */
+NCURSES_EXPORT(NCURSES_BOOL)
+_nc_retrace_bool(NCURSES_BOOL code)
+{
+    T((T_RETURN("%s"), code ? "TRUE" : "FALSE"));
+    return code;
+}
+
+/* Trace 'int' return-values */
+NCURSES_EXPORT(int)
+_nc_retrace_int(int code)
+{
+    T((T_RETURN("%d"), code));
+    return code;
+}
+
+/* Trace 'unsigned' return-values */
+NCURSES_EXPORT(unsigned)
+_nc_retrace_unsigned(unsigned code)
+{
+    T((T_RETURN("%#x"), code));
+    return code;
+}
+
+/* Trace 'char*' return-values */
+NCURSES_EXPORT(char *)
+_nc_retrace_ptr(char *code)
+{
+    T((T_RETURN("%s"), _nc_visbuf(code)));
+    return code;
+}
+
+/* Trace 'const char*' return-values */
+NCURSES_EXPORT(const char *)
+_nc_retrace_cptr(const char *code)
+{
+    T((T_RETURN("%s"), _nc_visbuf(code)));
+    return code;
+}
+
+/* Trace 'NCURSES_CONST void*' return-values */
+NCURSES_EXPORT(NCURSES_CONST void *)
+_nc_retrace_cvoid_ptr(NCURSES_CONST void *code)
+{
+    T((T_RETURN("%p"), code));
+    return code;
+}
+
+/* Trace 'void*' return-values */
+NCURSES_EXPORT(void *)
+_nc_retrace_void_ptr(void *code)
+{
+    T((T_RETURN("%p"), code));
+    return code;
+}
+
+/* Trace 'SCREEN *' return-values */
+NCURSES_EXPORT(SCREEN *)
+_nc_retrace_sp(SCREEN *code)
+{
+    T((T_RETURN("%p"), code));
+    return code;
+}
+
+/* Trace 'WINDOW *' return-values */
+NCURSES_EXPORT(WINDOW *)
+_nc_retrace_win(WINDOW *code)
+{
+    T((T_RETURN("%p"), code));
+    return code;
+}
+
+#if USE_REENTRANT
+/*
+ * Check if the given trace-mask is enabled.
+ *
+ * This function may be called from within one of the functions that fills
+ * in parameters for _tracef(), but in that case we do not want to lock the
+ * mutex, since it is already locked.
+ */
+NCURSES_EXPORT(int)
+_nc_use_tracef(unsigned mask)
+{
+    bool result = FALSE;
+
+    _nc_lock_global(tst_tracef);
+    if (!_nc_globals.nested_tracef++) {
+	if ((result = (_nc_tracing & (mask))) != 0
+	    && _nc_try_global(tracef) == 0) {
+	    /* we will call _nc_locked_tracef(), no nesting so far */
+	} else {
+	    /* we will not call _nc_locked_tracef() */
+	    _nc_globals.nested_tracef = 0;
+	}
+    } else {
+	/* we may call _nc_locked_tracef(), but with nested_tracef > 0 */
+	result = (_nc_tracing & (mask));
+    }
+    _nc_unlock_global(tst_tracef);
+    return result;
+}
+
+/*
+ * We call this if _nc_use_tracef() returns true, which means we must unlock
+ * the tracef mutex.
+ */
+NCURSES_EXPORT(void)
+_nc_locked_tracef(const char *fmt,...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    _nc_va_tracef(fmt, ap);
+    va_end(ap);
+
+    if (--(_nc_globals.nested_tracef) == 0)
+	_nc_unlock_global(tracef);
+}
+#endif /* USE_REENTRANT */
+
+#endif /* TRACE */
diff --git a/ncurses/trace/lib_traceatr.c b/ncurses/trace/lib_traceatr.c
new file mode 100644
index 0000000..45a03ce
--- /dev/null
+++ b/ncurses/trace/lib_traceatr.c
@@ -0,0 +1,358 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Thomas Dickey                           1996-on                 *
+ *     and: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+ *	lib_traceatr.c - Tracing/Debugging routines (attributes)
+ */
+
+#include <curses.priv.h>
+#include <term.h>		/* acs_chars */
+
+MODULE_ID("$Id: lib_traceatr.c,v 1.63 2008/08/03 16:24:53 tom Exp $")
+
+#define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name))
+
+#ifdef TRACE
+
+static const char l_brace[] = StringOf(L_BRACE);
+static const char r_brace[] = StringOf(R_BRACE);
+
+#ifndef USE_TERMLIB
+
+#define my_buffer _nc_globals.traceatr_color_buf
+#define my_select _nc_globals.traceatr_color_sel
+#define my_cached _nc_globals.traceatr_color_last
+
+static char *
+color_of(int c)
+{
+    if (c != my_cached) {
+	my_cached = c;
+	my_select = !my_select;
+	if (c == COLOR_DEFAULT)
+	    strcpy(my_buffer[my_select], "default");
+	else
+	    sprintf(my_buffer[my_select], "color%d", c);
+    }
+    return my_buffer[my_select];
+}
+
+#undef my_buffer
+#undef my_select
+#endif /* !USE_TERMLIB */
+
+NCURSES_EXPORT(char *)
+_traceattr2(int bufnum, chtype newmode)
+{
+    static const struct {
+	unsigned int val;
+	const char *name;
+    } names[] =
+    {
+	/* *INDENT-OFF* */
+	{ A_STANDOUT,		"A_STANDOUT" },
+	{ A_UNDERLINE,		"A_UNDERLINE" },
+	{ A_REVERSE,		"A_REVERSE" },
+	{ A_BLINK,		"A_BLINK" },
+	{ A_DIM,		"A_DIM" },
+	{ A_BOLD,		"A_BOLD" },
+	{ A_ALTCHARSET,		"A_ALTCHARSET" },
+	{ A_INVIS,		"A_INVIS" },
+	{ A_PROTECT,		"A_PROTECT" },
+	{ A_CHARTEXT,		"A_CHARTEXT" },
+	{ A_NORMAL,		"A_NORMAL" },
+	{ A_COLOR,		"A_COLOR" },
+	/* *INDENT-ON* */
+
+    }
+#ifndef USE_TERMLIB
+    ,
+	colors[] =
+    {
+	/* *INDENT-OFF* */
+	{ COLOR_BLACK,		"COLOR_BLACK" },
+	{ COLOR_RED,		"COLOR_RED" },
+	{ COLOR_GREEN,		"COLOR_GREEN" },
+	{ COLOR_YELLOW,		"COLOR_YELLOW" },
+	{ COLOR_BLUE,		"COLOR_BLUE" },
+	{ COLOR_MAGENTA,	"COLOR_MAGENTA" },
+	{ COLOR_CYAN,		"COLOR_CYAN" },
+	{ COLOR_WHITE,		"COLOR_WHITE" },
+	/* *INDENT-ON* */
+
+    }
+#endif /* !USE_TERMLIB */
+    ;
+    size_t n;
+    char temp[80];
+    char *result = _nc_trace_buf(bufnum, BUFSIZ);
+
+    if (result != 0) {
+	unsigned save_nc_tracing = _nc_tracing;
+
+	_nc_tracing = 0;
+
+	strcpy(result, l_brace);
+
+	for (n = 0; n < SIZEOF(names); n++) {
+	    if ((newmode & names[n].val) != 0) {
+		if (result[1] != '\0')
+		    result = _nc_trace_bufcat(bufnum, "|");
+		result = _nc_trace_bufcat(bufnum, names[n].name);
+
+		if (names[n].val == A_COLOR) {
+		    short pairnum = PAIR_NUMBER(newmode);
+#ifdef USE_TERMLIB
+		    /* pair_content lives in libncurses */
+		    (void) sprintf(temp, "{%d}", pairnum);
+#else
+		    short fg, bg;
+
+		    if (pair_content(pairnum, &fg, &bg) == OK) {
+			(void) sprintf(temp,
+				       "{%d = {%s, %s}}",
+				       pairnum,
+				       COLOR_OF(fg),
+				       COLOR_OF(bg));
+		    } else {
+			(void) sprintf(temp, "{%d}", pairnum);
+		    }
+#endif
+		    result = _nc_trace_bufcat(bufnum, temp);
+		}
+	    }
+	}
+	if (ChAttrOf(newmode) == A_NORMAL) {
+	    if (result != 0 && result[1] != '\0')
+		(void) _nc_trace_bufcat(bufnum, "|");
+	    (void) _nc_trace_bufcat(bufnum, "A_NORMAL");
+	}
+
+	_nc_tracing = save_nc_tracing;
+	result = _nc_trace_bufcat(bufnum, r_brace);
+    }
+    return result;
+}
+
+NCURSES_EXPORT(char *)
+_traceattr(attr_t newmode)
+{
+    return _traceattr2(0, newmode);
+}
+
+/* Trace 'int' return-values */
+NCURSES_EXPORT(attr_t)
+_nc_retrace_attr_t(attr_t code)
+{
+    T((T_RETURN("%s"), _traceattr(code)));
+    return code;
+}
+
+const char *
+_nc_altcharset_name(attr_t attr, chtype ch)
+{
+    typedef struct {
+	unsigned int val;
+	const char *name;
+    } ALT_NAMES;
+    static const ALT_NAMES names[] =
+    {
+	{'l', "ACS_ULCORNER"},	/* upper left corner */
+	{'m', "ACS_LLCORNER"},	/* lower left corner */
+	{'k', "ACS_URCORNER"},	/* upper right corner */
+	{'j', "ACS_LRCORNER"},	/* lower right corner */
+	{'t', "ACS_LTEE"},	/* tee pointing right */
+	{'u', "ACS_RTEE"},	/* tee pointing left */
+	{'v', "ACS_BTEE"},	/* tee pointing up */
+	{'w', "ACS_TTEE"},	/* tee pointing down */
+	{'q', "ACS_HLINE"},	/* horizontal line */
+	{'x', "ACS_VLINE"},	/* vertical line */
+	{'n', "ACS_PLUS"},	/* large plus or crossover */
+	{'o', "ACS_S1"},	/* scan line 1 */
+	{'s', "ACS_S9"},	/* scan line 9 */
+	{'`', "ACS_DIAMOND"},	/* diamond */
+	{'a', "ACS_CKBOARD"},	/* checker board (stipple) */
+	{'f', "ACS_DEGREE"},	/* degree symbol */
+	{'g', "ACS_PLMINUS"},	/* plus/minus */
+	{'~', "ACS_BULLET"},	/* bullet */
+	{',', "ACS_LARROW"},	/* arrow pointing left */
+	{'+', "ACS_RARROW"},	/* arrow pointing right */
+	{'.', "ACS_DARROW"},	/* arrow pointing down */
+	{'-', "ACS_UARROW"},	/* arrow pointing up */
+	{'h', "ACS_BOARD"},	/* board of squares */
+	{'i', "ACS_LANTERN"},	/* lantern symbol */
+	{'0', "ACS_BLOCK"},	/* solid square block */
+	{'p', "ACS_S3"},	/* scan line 3 */
+	{'r', "ACS_S7"},	/* scan line 7 */
+	{'y', "ACS_LEQUAL"},	/* less/equal */
+	{'z', "ACS_GEQUAL"},	/* greater/equal */
+	{'{', "ACS_PI"},	/* Pi */
+	{'|', "ACS_NEQUAL"},	/* not equal */
+	{'}', "ACS_STERLING"},	/* UK pound sign */
+	{'\0', (char *) 0}
+    };
+
+    const char *result = 0;
+
+    if ((attr & A_ALTCHARSET) && (acs_chars != 0)) {
+	char *cp;
+	char *found = 0;
+	const ALT_NAMES *sp;
+
+	for (cp = acs_chars; cp[0] && cp[1]; cp += 2) {
+	    if (ChCharOf(cp[1]) == ChCharOf(ch)) {
+		found = cp;
+		/* don't exit from loop - there may be redefinitions */
+	    }
+	}
+
+	if (found != 0) {
+	    ch = ChCharOf(*found);
+	    for (sp = names; sp->val; sp++)
+		if (sp->val == ch) {
+		    result = sp->name;
+		    break;
+		}
+	}
+    }
+    return result;
+}
+
+NCURSES_EXPORT(char *)
+_tracechtype2(int bufnum, chtype ch)
+{
+    const char *found;
+    char *result = _nc_trace_buf(bufnum, BUFSIZ);
+
+    if (result != 0) {
+	strcpy(result, l_brace);
+	if ((found = _nc_altcharset_name(ChAttrOf(ch), ch)) != 0) {
+	    (void) _nc_trace_bufcat(bufnum, found);
+	} else
+	    (void) _nc_trace_bufcat(bufnum, _nc_tracechar(SP, (int) ChCharOf(ch)));
+
+	if (ChAttrOf(ch) != A_NORMAL) {
+	    (void) _nc_trace_bufcat(bufnum, " | ");
+	    (void) _nc_trace_bufcat(bufnum,
+				    _traceattr2(bufnum + 20, ChAttrOf(ch)));
+	}
+
+	result = _nc_trace_bufcat(bufnum, r_brace);
+    }
+    return result;
+}
+
+NCURSES_EXPORT(char *)
+_tracechtype(chtype ch)
+{
+    return _tracechtype2(0, ch);
+}
+
+/* Trace 'chtype' return-values */
+NCURSES_EXPORT(chtype)
+_nc_retrace_chtype(chtype code)
+{
+    T((T_RETURN("%s"), _tracechtype(code)));
+    return code;
+}
+
+#if USE_WIDEC_SUPPORT
+NCURSES_EXPORT(char *)
+_tracecchar_t2(int bufnum, const cchar_t *ch)
+{
+    char *result = _nc_trace_buf(bufnum, BUFSIZ);
+    attr_t attr;
+    const char *found;
+
+    if (result != 0) {
+	strcpy(result, l_brace);
+	if (ch != 0) {
+	    attr = AttrOfD(ch);
+	    if ((found = _nc_altcharset_name(attr, (chtype) CharOfD(ch))) != 0) {
+		(void) _nc_trace_bufcat(bufnum, found);
+		attr &= ~A_ALTCHARSET;
+	    } else if (isWidecExt(CHDEREF(ch))) {
+		(void) _nc_trace_bufcat(bufnum, "{NAC}");
+		attr &= ~A_CHARTEXT;
+	    } else {
+		PUTC_DATA;
+		int n;
+
+		PUTC_INIT;
+		(void) _nc_trace_bufcat(bufnum, "{ ");
+		for (PUTC_i = 0; PUTC_i < CCHARW_MAX; ++PUTC_i) {
+		    PUTC_ch = ch->chars[PUTC_i];
+		    if (PUTC_ch == L'\0')
+			break;
+		    PUTC_n = wcrtomb(PUTC_buf, ch->chars[PUTC_i], &PUT_st);
+		    if (PUTC_n <= 0) {
+			if (PUTC_ch != L'\0') {
+			    /* it could not be a multibyte sequence */
+			    (void) _nc_trace_bufcat(bufnum,
+						    _nc_tracechar(SP,
+								  UChar(ch->chars[PUTC_i])));
+			}
+			break;
+		    }
+		    for (n = 0; n < PUTC_n; n++) {
+			if (n)
+			    (void) _nc_trace_bufcat(bufnum, ", ");
+			(void) _nc_trace_bufcat(bufnum,
+						_nc_tracechar(SP,
+							      UChar(PUTC_buf[n])));
+		    }
+		}
+		(void) _nc_trace_bufcat(bufnum, " }");
+	    }
+	    if (attr != A_NORMAL) {
+		(void) _nc_trace_bufcat(bufnum, " | ");
+		(void) _nc_trace_bufcat(bufnum, _traceattr2(bufnum + 20, attr));
+	    }
+	}
+
+	result = _nc_trace_bufcat(bufnum, r_brace);
+    }
+    return result;
+}
+
+NCURSES_EXPORT(char *)
+_tracecchar_t(const cchar_t *ch)
+{
+    return _tracecchar_t2(0, ch);
+}
+#endif
+
+#else
+EMPTY_MODULE(_nc_lib_traceatr)
+#endif /* TRACE */
diff --git a/ncurses/trace/lib_tracebits.c b/ncurses/trace/lib_tracebits.c
new file mode 100644
index 0000000..cc441b3
--- /dev/null
+++ b/ncurses/trace/lib_tracebits.c
@@ -0,0 +1,266 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+#include <term.h>		/* cur_term */
+
+MODULE_ID("$Id: lib_tracebits.c,v 1.17 2008/08/03 16:09:26 tom Exp $")
+
+#if SVR4_TERMIO && !defined(_POSIX_SOURCE)
+#define _POSIX_SOURCE
+#endif
+
+#if HAVE_SYS_TERMIO_H
+#include <sys/termio.h>		/* needed for ISC */
+#endif
+
+#ifdef __EMX__
+#include <io.h>
+#endif
+
+/* may be undefined if we're using termio.h */
+#ifndef TOSTOP
+#define TOSTOP 0
+#endif
+
+#ifndef IEXTEN
+#define IEXTEN 0
+#endif
+
+#ifndef ONLCR
+#define ONLCR 0
+#endif
+
+#ifndef OCRNL
+#define OCRNL 0
+#endif
+
+#ifndef ONOCR
+#define ONOCR 0
+#endif
+
+#ifndef ONLRET
+#define ONLRET 0
+#endif
+
+#ifdef TRACE
+
+typedef struct {
+    unsigned int val;
+    const char *name;
+} BITNAMES;
+
+static void
+lookup_bits(char *buf, const BITNAMES * table, const char *label, unsigned int val)
+{
+    const BITNAMES *sp;
+
+    (void) strcat(buf, label);
+    (void) strcat(buf, ": {");
+    for (sp = table; sp->name; sp++)
+	if (sp->val != 0
+	    && (val & sp->val) == sp->val) {
+	    (void) strcat(buf, sp->name);
+	    (void) strcat(buf, ", ");
+	}
+    if (buf[strlen(buf) - 2] == ',')
+	buf[strlen(buf) - 2] = '\0';
+    (void) strcat(buf, "} ");
+}
+
+NCURSES_EXPORT(char *)
+_nc_trace_ttymode(TTY * tty)
+/* describe the state of the terminal control bits exactly */
+{
+    char *buf;
+
+#ifdef TERMIOS
+    static const BITNAMES iflags[] =
+    {
+	{BRKINT, "BRKINT"},
+	{IGNBRK, "IGNBRK"},
+	{IGNPAR, "IGNPAR"},
+	{PARMRK, "PARMRK"},
+	{INPCK, "INPCK"},
+	{ISTRIP, "ISTRIP"},
+	{INLCR, "INLCR"},
+	{IGNCR, "IGNC"},
+	{ICRNL, "ICRNL"},
+	{IXON, "IXON"},
+	{IXOFF, "IXOFF"},
+	{0, NULL}
+#define ALLIN	(BRKINT|IGNBRK|IGNPAR|PARMRK|INPCK|ISTRIP|INLCR|IGNCR|ICRNL|IXON|IXOFF)
+    }, oflags[] =
+    {
+	{OPOST, "OPOST"},
+	{OFLAGS_TABS, "XTABS"},
+	{ONLCR, "ONLCR"},
+	{OCRNL, "OCRNL"},
+	{ONOCR, "ONOCR"},
+	{ONLRET, "ONLRET"},
+	{0, NULL}
+#define ALLOUT	(OPOST|OFLAGS_TABS|ONLCR|OCRNL|ONOCR|ONLRET)
+    }, cflags[] =
+    {
+	{CLOCAL, "CLOCAL"},
+	{CREAD, "CREAD"},
+	{CSTOPB, "CSTOPB"},
+#if !defined(CS5) || !defined(CS8)
+	{CSIZE, "CSIZE"},
+#endif
+	{HUPCL, "HUPCL"},
+	{PARENB, "PARENB"},
+	{PARODD | PARENB, "PARODD"},	/* concession to readability */
+	{0, NULL}
+#define ALLCTRL	(CLOCAL|CREAD|CSIZE|CSTOPB|HUPCL|PARENB|PARODD)
+    }, lflags[] =
+    {
+	{ECHO, "ECHO"},
+	{ECHOE | ECHO, "ECHOE"},	/* concession to readability */
+	{ECHOK | ECHO, "ECHOK"},	/* concession to readability */
+	{ECHONL, "ECHONL"},
+	{ICANON, "ICANON"},
+	{ISIG, "ISIG"},
+	{NOFLSH, "NOFLSH"},
+	{TOSTOP, "TOSTOP"},
+	{IEXTEN, "IEXTEN"},
+	{0, NULL}
+#define ALLLOCAL	(ECHO|ECHONL|ICANON|ISIG|NOFLSH|TOSTOP|IEXTEN)
+    };
+
+    buf = _nc_trace_buf(0,
+			8 + sizeof(iflags) +
+			8 + sizeof(oflags) +
+			8 + sizeof(cflags) +
+			8 + sizeof(lflags) +
+			8);
+    if (buf != 0) {
+
+	if (tty->c_iflag & ALLIN)
+	    lookup_bits(buf, iflags, "iflags", tty->c_iflag);
+
+	if (tty->c_oflag & ALLOUT)
+	    lookup_bits(buf, oflags, "oflags", tty->c_oflag);
+
+	if (tty->c_cflag & ALLCTRL)
+	    lookup_bits(buf, cflags, "cflags", tty->c_cflag);
+
+#if defined(CS5) && defined(CS8)
+	{
+	    static struct {
+		int value;
+		const char *name;
+	    } csizes[] = {
+#define CS_DATA(name) { name, #name " " }
+		CS_DATA(CS5),
+#ifdef CS6
+		    CS_DATA(CS6),
+#endif
+#ifdef CS7
+		    CS_DATA(CS7),
+#endif
+		    CS_DATA(CS8),
+	    };
+	    const char *result = "CSIZE? ";
+	    int value = (tty->c_cflag & CSIZE);
+	    unsigned n;
+
+	    if (value != 0) {
+		for (n = 0; n < SIZEOF(csizes); n++) {
+		    if (csizes[n].value == value) {
+			result = csizes[n].name;
+			break;
+		    }
+		}
+	    }
+	    strcat(buf, result);
+	}
+#endif
+
+	if (tty->c_lflag & ALLLOCAL)
+	    lookup_bits(buf, lflags, "lflags", tty->c_lflag);
+    }
+#else
+    /* reference: ttcompat(4M) on SunOS 4.1 */
+#ifndef EVENP
+#define EVENP 0
+#endif
+#ifndef LCASE
+#define LCASE 0
+#endif
+#ifndef LLITOUT
+#define LLITOUT 0
+#endif
+#ifndef ODDP
+#define ODDP 0
+#endif
+#ifndef TANDEM
+#define TANDEM 0
+#endif
+
+    static const BITNAMES cflags[] =
+    {
+	{CBREAK, "CBREAK"},
+	{CRMOD, "CRMOD"},
+	{ECHO, "ECHO"},
+	{EVENP, "EVENP"},
+	{LCASE, "LCASE"},
+	{LLITOUT, "LLITOUT"},
+	{ODDP, "ODDP"},
+	{RAW, "RAW"},
+	{TANDEM, "TANDEM"},
+	{XTABS, "XTABS"},
+	{0, NULL}
+#define ALLCTRL	(CBREAK|CRMOD|ECHO|EVENP|LCASE|LLITOUT|ODDP|RAW|TANDEM|XTABS)
+    };
+
+    buf = _nc_trace_buf(0,
+			8 + sizeof(cflags));
+    if (buf != 0) {
+	if (tty->sg_flags & ALLCTRL) {
+	    lookup_bits(buf, cflags, "cflags", tty->sg_flags);
+	}
+    }
+#endif
+    return (buf);
+}
+
+NCURSES_EXPORT(char *)
+_nc_tracebits(void)
+{
+    return _nc_trace_ttymode(&(cur_term->Nttyb));
+}
+#else
+EMPTY_MODULE(_nc_tracebits)
+#endif /* TRACE */
diff --git a/ncurses/trace/lib_tracechr.c b/ncurses/trace/lib_tracechr.c
new file mode 100644
index 0000000..79cf03b
--- /dev/null
+++ b/ncurses/trace/lib_tracechr.c
@@ -0,0 +1,82 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+/*
+ *	lib_tracechr.c - Tracing/Debugging routines
+ */
+#include <curses.priv.h>
+
+#include <ctype.h>
+
+MODULE_ID("$Id: lib_tracechr.c,v 1.19 2008/08/03 15:39:29 tom Exp $")
+
+#ifdef TRACE
+
+NCURSES_EXPORT(char *)
+_nc_tracechar(SCREEN *sp, int ch)
+{
+    NCURSES_CONST char *name;
+    char *MyBuffer = ((sp != 0)
+		      ? sp->tracechr_buf
+		      : _nc_globals.tracechr_buf);
+
+    if (ch > KEY_MIN || ch < 0) {
+	name = _nc_keyname(sp, ch);
+	if (name == 0 || *name == '\0')
+	    name = "NULL";
+	(void) sprintf(MyBuffer, "'%.30s' = %#03o", name, ch);
+    } else if (!is8bits(ch) || !isprint(UChar(ch))) {
+	/*
+	 * workaround for glibc bug:
+	 * sprintf changes the result from unctrl() to an empty string if it
+	 * does not correspond to a valid multibyte sequence.
+	 */
+	(void) sprintf(MyBuffer, "%#03o", ch);
+    } else {
+	name = _nc_unctrl(sp, (chtype) ch);
+	if (name == 0 || *name == 0)
+	    name = "null";	/* shouldn't happen */
+	(void) sprintf(MyBuffer, "'%.30s' = %#03o", name, ch);
+    }
+    return (MyBuffer);
+}
+
+NCURSES_EXPORT(char *)
+_tracechar(int ch)
+{
+    return _nc_tracechar(SP, ch);
+}
+#else
+EMPTY_MODULE(_nc_lib_tracechr)
+#endif
diff --git a/ncurses/trace/lib_tracedmp.c b/ncurses/trace/lib_tracedmp.c
new file mode 100644
index 0000000..58732a0
--- /dev/null
+++ b/ncurses/trace/lib_tracedmp.c
@@ -0,0 +1,184 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Thomas E. Dickey 1996-on                                        *
+ *     and: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+ *	lib_tracedmp.c - Tracing/Debugging routines
+ */
+
+#include <curses.priv.h>
+#include <ctype.h>
+
+MODULE_ID("$Id: lib_tracedmp.c,v 1.31 2008/08/16 19:30:56 tom Exp $")
+
+#ifdef TRACE
+
+#define my_buffer _nc_globals.tracedmp_buf
+#define my_length _nc_globals.tracedmp_used
+
+NCURSES_EXPORT(void)
+_tracedump(const char *name, WINDOW *win)
+{
+    int i, j, n, width;
+
+    /* compute narrowest possible display width */
+    for (width = i = 0; i <= win->_maxy; ++i) {
+	n = 0;
+	for (j = 0; j <= win->_maxx; ++j) {
+	    if (CharOf(win->_line[i].text[j]) != L(' ')
+		|| AttrOf(win->_line[i].text[j]) != A_NORMAL
+		|| GetPair(win->_line[i].text[j]) != 0) {
+		n = j;
+	    }
+	}
+
+	if (n > width)
+	    width = n;
+    }
+    if (width < win->_maxx)
+	++width;
+    if (++width + 1 > (int) my_length) {
+	my_length = 2 * (width + 1);
+	my_buffer = typeRealloc(char, my_length, my_buffer);
+    }
+
+    for (n = 0; n <= win->_maxy; ++n) {
+	char *ep = my_buffer;
+	bool haveattrs, havecolors;
+
+	/*
+	 * Dump A_CHARTEXT part.  It is more important to make the grid line up
+	 * in the trace file than to represent control- and wide-characters, so
+	 * we map those to '.' and '?' respectively.
+	 */
+	for (j = 0; j < width; ++j) {
+	    chtype test = CharOf(win->_line[n].text[j]);
+	    ep[j] = (char) ((UChar(test) == test
+#if USE_WIDEC_SUPPORT
+			     && (win->_line[n].text[j].chars[1] == 0)
+#endif
+			    )
+			    ? (iscntrl(UChar(test))
+			       ? '.'
+			       : UChar(test))
+			    : '?');
+	}
+	ep[j] = '\0';
+	_tracef("%s[%2d] %3ld%3ld ='%s'",
+		name, n,
+		(long) win->_line[n].firstchar,
+		(long) win->_line[n].lastchar,
+		ep);
+
+	/* if there are multi-column characters on the line, print them now */
+	if_WIDEC({
+	    bool multicolumn = FALSE;
+	    for (j = 0; j < width; ++j)
+		if (WidecExt(win->_line[n].text[j]) != 0) {
+		    multicolumn = TRUE;
+		    break;
+		}
+	    if (multicolumn) {
+		ep = my_buffer;
+		for (j = 0; j < width; ++j) {
+		    int test = WidecExt(win->_line[n].text[j]);
+		    if (test) {
+			ep[j] = (char) (test + '0');
+		    } else {
+			ep[j] = ' ';
+		    }
+		}
+		ep[j] = '\0';
+		_tracef("%*s[%2d]%*s='%s'", (int) strlen(name),
+			"widec", n, 8, " ", my_buffer);
+	    }
+	});
+
+	/* dump A_COLOR part, will screw up if there are more than 96 */
+	havecolors = FALSE;
+	for (j = 0; j < width; ++j)
+	    if (GetPair(win->_line[n].text[j]) != 0) {
+		havecolors = TRUE;
+		break;
+	    }
+	if (havecolors) {
+	    ep = my_buffer;
+	    for (j = 0; j < width; ++j) {
+		int pair = GetPair(win->_line[n].text[j]);
+		if (pair >= 52)
+		    ep[j] = '?';
+		else if (pair >= 36)
+		    ep[j] = (char) (pair + 'A');
+		else if (pair >= 10)
+		    ep[j] = (char) (pair + 'a');
+		else if (pair >= 1)
+		    ep[j] = (char) (pair + '0');
+		else
+		    ep[j] = ' ';
+	    }
+	    ep[j] = '\0';
+	    _tracef("%*s[%2d]%*s='%s'", (int) strlen(name),
+		    "colors", n, 8, " ", my_buffer);
+	}
+
+	for (i = 0; i < 4; ++i) {
+	    const char *hex = " 123456789ABCDEF";
+	    attr_t mask = (0xf << ((i + 4) * 4));
+
+	    haveattrs = FALSE;
+	    for (j = 0; j < width; ++j)
+		if (AttrOf(win->_line[n].text[j]) & mask) {
+		    haveattrs = TRUE;
+		    break;
+		}
+	    if (haveattrs) {
+		ep = my_buffer;
+		for (j = 0; j < width; ++j)
+		    ep[j] = hex[(AttrOf(win->_line[n].text[j]) & mask) >>
+				((i + 4) * 4)];
+		ep[j] = '\0';
+		_tracef("%*s%d[%2d]%*s='%s'", (int) strlen(name) -
+			1, "attrs", i, n, 8, " ", my_buffer);
+	    }
+	}
+    }
+#if NO_LEAKS
+    free(my_buffer);
+    my_buffer = 0;
+    my_length = 0;
+#endif
+}
+
+#else
+EMPTY_MODULE(_nc_lib_tracedmp)
+#endif /* TRACE */
diff --git a/ncurses/trace/lib_tracemse.c b/ncurses/trace/lib_tracemse.c
new file mode 100644
index 0000000..74cc177
--- /dev/null
+++ b/ncurses/trace/lib_tracemse.c
@@ -0,0 +1,125 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+/*
+ *	lib_tracemse.c - Tracing/Debugging routines (mouse events)
+ */
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_tracemse.c,v 1.15 2008/08/03 15:39:29 tom Exp $")
+
+#ifdef TRACE
+
+#define my_buffer sp->tracemse_buf
+
+NCURSES_EXPORT(char *)
+_nc_tracemouse(SCREEN *sp, MEVENT const *ep)
+{
+    (void) sprintf(my_buffer, TRACEMSE_FMT,
+		   ep->id,
+		   ep->x,
+		   ep->y,
+		   ep->z,
+		   (unsigned long) ep->bstate);
+
+#define SHOW(m, s) if ((ep->bstate & m) == m) strcat(strcat(my_buffer, s), ", ")
+
+    SHOW(BUTTON1_RELEASED, "release-1");
+    SHOW(BUTTON1_PRESSED, "press-1");
+    SHOW(BUTTON1_CLICKED, "click-1");
+    SHOW(BUTTON1_DOUBLE_CLICKED, "doubleclick-1");
+    SHOW(BUTTON1_TRIPLE_CLICKED, "tripleclick-1");
+#if NCURSES_MOUSE_VERSION == 1
+    SHOW(BUTTON1_RESERVED_EVENT, "reserved-1");
+#endif
+
+    SHOW(BUTTON2_RELEASED, "release-2");
+    SHOW(BUTTON2_PRESSED, "press-2");
+    SHOW(BUTTON2_CLICKED, "click-2");
+    SHOW(BUTTON2_DOUBLE_CLICKED, "doubleclick-2");
+    SHOW(BUTTON2_TRIPLE_CLICKED, "tripleclick-2");
+#if NCURSES_MOUSE_VERSION == 1
+    SHOW(BUTTON2_RESERVED_EVENT, "reserved-2");
+#endif
+
+    SHOW(BUTTON3_RELEASED, "release-3");
+    SHOW(BUTTON3_PRESSED, "press-3");
+    SHOW(BUTTON3_CLICKED, "click-3");
+    SHOW(BUTTON3_DOUBLE_CLICKED, "doubleclick-3");
+    SHOW(BUTTON3_TRIPLE_CLICKED, "tripleclick-3");
+#if NCURSES_MOUSE_VERSION == 1
+    SHOW(BUTTON3_RESERVED_EVENT, "reserved-3");
+#endif
+
+    SHOW(BUTTON4_RELEASED, "release-4");
+    SHOW(BUTTON4_PRESSED, "press-4");
+    SHOW(BUTTON4_CLICKED, "click-4");
+    SHOW(BUTTON4_DOUBLE_CLICKED, "doubleclick-4");
+    SHOW(BUTTON4_TRIPLE_CLICKED, "tripleclick-4");
+#if NCURSES_MOUSE_VERSION == 1
+    SHOW(BUTTON4_RESERVED_EVENT, "reserved-4");
+#endif
+
+#if NCURSES_MOUSE_VERSION == 2
+    SHOW(BUTTON5_RELEASED, "release-5");
+    SHOW(BUTTON5_PRESSED, "press-5");
+    SHOW(BUTTON5_CLICKED, "click-5");
+    SHOW(BUTTON5_DOUBLE_CLICKED, "doubleclick-5");
+    SHOW(BUTTON5_TRIPLE_CLICKED, "tripleclick-5");
+#endif
+
+    SHOW(BUTTON_CTRL, "ctrl");
+    SHOW(BUTTON_SHIFT, "shift");
+    SHOW(BUTTON_ALT, "alt");
+    SHOW(ALL_MOUSE_EVENTS, "all-events");
+    SHOW(REPORT_MOUSE_POSITION, "position");
+
+#undef SHOW
+
+    if (my_buffer[strlen(my_buffer) - 1] == ' ')
+	my_buffer[strlen(my_buffer) - 2] = '\0';
+    (void) strcat(my_buffer, "}");
+    return (my_buffer);
+}
+
+NCURSES_EXPORT(char *)
+_tracemouse(MEVENT const *ep)
+{
+    return _nc_tracemouse(SP, ep);
+}
+
+#else /* !TRACE */
+EMPTY_MODULE(_nc_lib_tracemouse)
+#endif
diff --git a/ncurses/trace/trace_buf.c b/ncurses/trace/trace_buf.c
new file mode 100644
index 0000000..6345acc
--- /dev/null
+++ b/ncurses/trace/trace_buf.c
@@ -0,0 +1,114 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Thomas E. Dickey                 1997-on                        *
+ ****************************************************************************/
+/*
+ *	trace_buf.c - Tracing/Debugging buffers (attributes)
+ */
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: trace_buf.c,v 1.14 2008/08/03 15:13:56 tom Exp $")
+
+#define MyList _nc_globals.tracebuf_ptr
+#define MySize _nc_globals.tracebuf_used
+
+static char *
+_nc_trace_alloc(int bufnum, size_t want)
+{
+    char *result = 0;
+
+    if (bufnum >= 0) {
+	if ((size_t) (bufnum + 1) > MySize) {
+	    size_t need = (bufnum + 1) * 2;
+	    if ((MyList = typeRealloc(TRACEBUF, need, MyList)) != 0) {
+		while (need > MySize)
+		    MyList[MySize++].text = 0;
+	    }
+	}
+
+	if (MyList != 0) {
+	    if (MyList[bufnum].text == 0
+		|| want > MyList[bufnum].size) {
+		MyList[bufnum].text = typeRealloc(char, want, MyList[bufnum].text);
+		if (MyList[bufnum].text != 0)
+		    MyList[bufnum].size = want;
+	    }
+	    result = MyList[bufnum].text;
+	}
+    }
+#if NO_LEAKS
+    else {
+	if (MySize) {
+	    if (MyList) {
+		while (MySize--) {
+		    if (MyList[MySize].text != 0) {
+			free(MyList[MySize].text);
+		    }
+		}
+		free(MyList);
+		MyList = 0;
+	    }
+	    MySize = 0;
+	}
+    }
+#endif
+    return result;
+}
+
+/*
+ * (re)Allocate a buffer big enough for the caller's wants.
+ */
+NCURSES_EXPORT(char *)
+_nc_trace_buf(int bufnum, size_t want)
+{
+    char *result = _nc_trace_alloc(bufnum, want);
+    if (result != 0)
+	*result = '\0';
+    return result;
+}
+
+/*
+ * Append a new string to an existing buffer.
+ */
+NCURSES_EXPORT(char *)
+_nc_trace_bufcat(int bufnum, const char *value)
+{
+    char *buffer = _nc_trace_alloc(bufnum, 0);
+    if (buffer != 0) {
+	size_t have = strlen(buffer);
+
+	buffer = _nc_trace_alloc(bufnum, 1 + have + strlen(value));
+	if (buffer != 0)
+	    (void) strcpy(buffer + have, value);
+
+    }
+    return buffer;
+}
diff --git a/ncurses/trace/trace_tries.c b/ncurses/trace/trace_tries.c
new file mode 100644
index 0000000..f813aba
--- /dev/null
+++ b/ncurses/trace/trace_tries.c
@@ -0,0 +1,78 @@
+/****************************************************************************
+ * Copyright (c) 1999-2007,2008 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            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Thomas E. Dickey <dickey@clark.net> 1999                        *
+ ****************************************************************************/
+/*
+ *	trace_tries.c - Tracing/Debugging buffers (keycode tries-trees)
+ */
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: trace_tries.c,v 1.13 2008/08/03 15:43:30 tom Exp $")
+
+#ifdef TRACE
+#define my_buffer _nc_globals.tracetry_buf
+#define my_length _nc_globals.tracetry_used
+
+static void
+recur_tries(TRIES * tree, unsigned level)
+{
+    if (level > my_length) {
+	my_length = (level + 1) * 4;
+	my_buffer = (unsigned char *) realloc(my_buffer, my_length);
+    }
+
+    while (tree != 0) {
+	if ((my_buffer[level] = tree->ch) == 0)
+	    my_buffer[level] = 128;
+	my_buffer[level + 1] = 0;
+	if (tree->value != 0) {
+	    _tracef("%5d: %s (%s)", tree->value,
+		    _nc_visbuf((char *) my_buffer), keyname(tree->value));
+	}
+	if (tree->child)
+	    recur_tries(tree->child, level + 1);
+	tree = tree->sibling;
+    }
+}
+
+NCURSES_EXPORT(void)
+_nc_trace_tries(TRIES * tree)
+{
+    my_buffer = typeMalloc(unsigned char, my_length = 80);
+    _tracef("BEGIN tries %p", tree);
+    recur_tries(tree, 0);
+    _tracef(". . . tries %p", tree);
+    free(my_buffer);
+}
+
+#else
+EMPTY_MODULE(_nc_trace_tries)
+#endif
diff --git a/ncurses/trace/trace_xnames.c b/ncurses/trace/trace_xnames.c
new file mode 100644
index 0000000..9b0b592
--- /dev/null
+++ b/ncurses/trace/trace_xnames.c
@@ -0,0 +1,75 @@
+/****************************************************************************
+ * Copyright (c) 1999,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            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Thomas E. Dickey <dickey@clark.net> 1999                        *
+ ****************************************************************************/
+/*
+ *	trace_xnames.c - Tracing/Debugging buffers (TERMTYPE extended names)
+ */
+
+#include <curses.priv.h>
+#include <term_entry.h>
+
+MODULE_ID("$Id: trace_xnames.c,v 1.5 2000/12/10 03:02:45 tom Exp $")
+
+NCURSES_EXPORT(void)
+_nc_trace_xnames(TERMTYPE * tp GCC_UNUSED)
+{
+#ifdef TRACE
+#if NCURSES_XNAMES
+    int limit = tp->ext_Booleans + tp->ext_Numbers + tp->ext_Strings;
+    int n, m;
+    if (limit) {
+	int begin_num = tp->ext_Booleans;
+	int begin_str = tp->ext_Booleans + tp->ext_Numbers;
+
+	_tracef("extended names (%s) %d = %d+%d+%d of %d+%d+%d",
+		tp->term_names,
+		limit,
+		tp->ext_Booleans, tp->ext_Numbers, tp->ext_Strings,
+		tp->num_Booleans, tp->num_Numbers, tp->num_Strings);
+	for (n = 0; n < limit; n++) {
+	    if ((m = n - begin_str) >= 0) {
+		_tracef("[%d] %s = %s", n,
+			tp->ext_Names[n],
+			_nc_visbuf(tp->Strings[tp->num_Strings + m - tp->ext_Strings]));
+	    } else if ((m = n - begin_num) >= 0) {
+		_tracef("[%d] %s = %d (num)", n,
+			tp->ext_Names[n],
+			tp->Numbers[tp->num_Numbers + m - tp->ext_Numbers]);
+	    } else {
+		_tracef("[%d] %s = %d (bool)", n,
+			tp->ext_Names[n],
+			tp->Booleans[tp->num_Booleans + n - tp->ext_Booleans]);
+	    }
+	}
+    }
+#endif
+#endif
+}
diff --git a/ncurses/trace/varargs.c b/ncurses/trace/varargs.c
new file mode 100644
index 0000000..f4ee467
--- /dev/null
+++ b/ncurses/trace/varargs.c
@@ -0,0 +1,184 @@
+/****************************************************************************
+ * Copyright (c) 2001-2007,2008 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            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Thomas E. Dickey 2001                                           *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+#include <ctype.h>
+
+MODULE_ID("$Id: varargs.c,v 1.7 2008/08/03 15:42:49 tom Exp $")
+
+#ifdef TRACE
+
+#define MAX_PARMS 10
+
+typedef enum {
+    atUnknown = 0, atInteger, atFloat, atPoint, atString
+} ARGTYPE;
+
+#define VA_INT(type) ival = va_arg(ap, type)
+#define VA_FLT(type) fval = va_arg(ap, type)
+#define VA_PTR(type) pval = (char *)va_arg(ap, type)
+#define VA_STR(type) sval = va_arg(ap, type)
+
+#define MyBuffer _nc_globals.tracearg_buf
+#define MyLength _nc_globals.tracearg_used
+
+/*
+ * Returns a string that represents the parameter list of a printf-style call.
+ */
+NCURSES_EXPORT(char *)
+_nc_varargs(const char *fmt, va_list ap)
+{
+    static char dummy[] = "";
+
+    char buffer[BUFSIZ];
+    const char *param;
+    int n;
+
+    if (fmt == 0 || *fmt == '\0')
+	return dummy;
+    if (MyLength == 0)
+	MyBuffer = typeMalloc(char, MyLength = BUFSIZ);
+    if (MyBuffer == 0)
+	return dummy;
+    *MyBuffer = '\0';
+
+    while (*fmt != '\0') {
+	if (*fmt == '%') {
+	    char *pval = 0;	/* avoid const-cast */
+	    const char *sval = "";
+	    double fval = 0.0;
+	    int done = FALSE;
+	    int ival = 0;
+	    int type = 0;
+	    ARGTYPE parm[MAX_PARMS];
+	    int parms = 0;
+	    ARGTYPE used = atUnknown;
+
+	    while (*++fmt != '\0' && !done) {
+
+		if (*fmt == '*') {
+		    VA_INT(int);
+		    if (parms < MAX_PARMS)
+			parm[parms++] = atInteger;
+		} else if (isalpha(UChar(*fmt))) {
+		    done = TRUE;
+		    switch (*fmt) {
+		    case 'Z':	/* FALLTHRU */
+		    case 'h':	/* FALLTHRU */
+		    case 'l':	/* FALLTHRU */
+			done = FALSE;
+			type = *fmt;
+			break;
+		    case 'i':	/* FALLTHRU */
+		    case 'd':	/* FALLTHRU */
+		    case 'u':	/* FALLTHRU */
+		    case 'x':	/* FALLTHRU */
+		    case 'X':	/* FALLTHRU */
+			if (type == 'l')
+			    VA_INT(long);
+			else if (type == 'Z')
+			    VA_INT(size_t);
+			else
+			    VA_INT(int);
+			used = atInteger;
+			break;
+		    case 'f':	/* FALLTHRU */
+		    case 'e':	/* FALLTHRU */
+		    case 'E':	/* FALLTHRU */
+		    case 'g':	/* FALLTHRU */
+		    case 'G':	/* FALLTHRU */
+			VA_FLT(double);
+			used = atFloat;
+			break;
+		    case 'c':
+			VA_INT(int);
+			used = atInteger;
+			break;
+		    case 's':
+			VA_STR(const char *);
+			used = atString;
+			break;
+		    case 'p':
+			VA_PTR(void *);
+			used = atPoint;
+			break;
+		    case 'n':
+			VA_PTR(int *);
+			used = atPoint;
+			break;
+		    default:
+			break;
+		    }
+		} else if (*fmt == '%') {
+		    done = TRUE;
+		}
+		if (used != atUnknown && parms < MAX_PARMS) {
+		    parm[parms++] = used;
+		    for (n = 0; n < parms; ++n) {
+			used = parm[n];
+			param = buffer;
+			switch (used) {
+			case atInteger:
+			    sprintf(buffer, "%d", ival);
+			    break;
+			case atFloat:
+			    sprintf(buffer, "%f", fval);
+			    break;
+			case atPoint:
+			    sprintf(buffer, "%p", pval);
+			    break;
+			case atString:
+			    param = _nc_visbuf2(1, sval);
+			    break;
+			case atUnknown:
+			default:
+			    strcpy(buffer, "?");
+			    break;
+			}
+			MyLength += strlen(param) + 2;
+			MyBuffer = typeRealloc(char, MyLength, MyBuffer);
+			sprintf(MyBuffer + strlen(MyBuffer), ", %s", param);
+		    }
+		}
+		used = atUnknown;
+	    }
+	} else {
+	    fmt++;
+	}
+    }
+
+    return (MyBuffer);
+}
+#else
+EMPTY_MODULE(_nc_varargs)
+#endif
diff --git a/ncurses/trace/visbuf.c b/ncurses/trace/visbuf.c
new file mode 100644
index 0000000..bf9fb14
--- /dev/null
+++ b/ncurses/trace/visbuf.c
@@ -0,0 +1,331 @@
+/****************************************************************************
+ * Copyright (c) 2001-2007,2008 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            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Thomas E. Dickey                        1996-on                 *
+ *     and: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+ *	visbuf.c - Tracing/Debugging support routines
+ */
+
+#define NEED_NCURSES_CH_T
+#include <curses.priv.h>
+
+#include <tic.h>
+#include <ctype.h>
+
+MODULE_ID("$Id: visbuf.c,v 1.32 2008/08/04 23:07:39 tom Exp $")
+
+#define NormalLen(len) (size_t) (((size_t)(len) + 1) * 4)
+#define WideLen(len)   (size_t) (((size_t)(len) + 1) * 4 * MB_CUR_MAX)
+
+#ifdef TRACE
+static const char d_quote[] = StringOf(D_QUOTE);
+static const char l_brace[] = StringOf(L_BRACE);
+static const char r_brace[] = StringOf(R_BRACE);
+#endif
+
+static char *
+_nc_vischar(char *tp, unsigned c)
+{
+    if (c == '"' || c == '\\') {
+	*tp++ = '\\';
+	*tp++ = (char) c;
+    } else if (is7bits(c) && (isgraph(c) || c == ' ')) {
+	*tp++ = (char) c;
+    } else if (c == '\n') {
+	*tp++ = '\\';
+	*tp++ = 'n';
+    } else if (c == '\r') {
+	*tp++ = '\\';
+	*tp++ = 'r';
+    } else if (c == '\b') {
+	*tp++ = '\\';
+	*tp++ = 'b';
+    } else if (c == '\033') {
+	*tp++ = '\\';
+	*tp++ = 'e';
+    } else if (UChar(c) == 0x7f) {
+	*tp++ = '\\';
+	*tp++ = '^';
+	*tp++ = '?';
+    } else if (is7bits(c) && iscntrl(UChar(c))) {
+	*tp++ = '\\';
+	*tp++ = '^';
+	*tp++ = (char) ('@' + c);
+    } else {
+	sprintf(tp, "\\%03lo", (unsigned long) ChCharOf(c));
+	tp += strlen(tp);
+    }
+    *tp = 0;
+    return tp;
+}
+
+static const char *
+_nc_visbuf2n(int bufnum, const char *buf, int len)
+{
+    const char *vbuf;
+    char *tp;
+    int c;
+
+    if (buf == 0)
+	return ("(null)");
+    if (buf == CANCELLED_STRING)
+	return ("(cancelled)");
+
+    if (len < 0)
+	len = (int) strlen(buf);
+
+#ifdef TRACE
+    vbuf = tp = _nc_trace_buf(bufnum, NormalLen(len));
+#else
+    {
+	static char *mybuf[4];
+	mybuf[bufnum] = typeRealloc(char, NormalLen(len), mybuf[bufnum]);
+	vbuf = tp = mybuf[bufnum];
+    }
+#endif
+    if (tp != 0) {
+	*tp++ = D_QUOTE;
+	while ((--len >= 0) && (c = *buf++) != '\0') {
+	    tp = _nc_vischar(tp, UChar(c));
+	}
+	*tp++ = D_QUOTE;
+	*tp++ = '\0';
+    } else {
+	vbuf = ("(_nc_visbuf2n failed)");
+    }
+    return (vbuf);
+}
+
+NCURSES_EXPORT(const char *)
+_nc_visbuf2(int bufnum, const char *buf)
+{
+    return _nc_visbuf2n(bufnum, buf, -1);
+}
+
+NCURSES_EXPORT(const char *)
+_nc_visbuf(const char *buf)
+{
+    return _nc_visbuf2(0, buf);
+}
+
+NCURSES_EXPORT(const char *)
+_nc_visbufn(const char *buf, int len)
+{
+    return _nc_visbuf2n(0, buf, len);
+}
+
+#ifdef TRACE
+#if USE_WIDEC_SUPPORT
+
+#if defined(USE_TERMLIB)
+#define _nc_wchstrlen _my_wchstrlen
+static int
+_nc_wchstrlen(const cchar_t *s)
+{
+    int result = 0;
+    while (CharOf(s[result]) != L'\0') {
+	result++;
+    }
+    return result;
+}
+#endif
+
+static const char *
+_nc_viswbuf2n(int bufnum, const wchar_t *buf, int len)
+{
+    const char *vbuf;
+    char *tp;
+    wchar_t c;
+
+    if (buf == 0)
+	return ("(null)");
+
+    if (len < 0)
+	len = (int) wcslen(buf);
+
+#ifdef TRACE
+    vbuf = tp = _nc_trace_buf(bufnum, WideLen(len));
+#else
+    {
+	static char *mybuf[2];
+	mybuf[bufnum] = typeRealloc(char, WideLen(len), mybuf[bufnum]);
+	vbuf = tp = mybuf[bufnum];
+    }
+#endif
+    if (tp != 0) {
+	*tp++ = D_QUOTE;
+	while ((--len >= 0) && (c = *buf++) != '\0') {
+	    char temp[CCHARW_MAX + 80];
+	    int j = wctomb(temp, c), k;
+	    if (j <= 0) {
+		sprintf(temp, "\\u%08X", (unsigned) c);
+		j = (int) strlen(temp);
+	    }
+	    for (k = 0; k < j; ++k) {
+		tp = _nc_vischar(tp, UChar(temp[k]));
+	    }
+	}
+	*tp++ = D_QUOTE;
+	*tp++ = '\0';
+    } else {
+	vbuf = ("(_nc_viswbuf2n failed)");
+    }
+    return (vbuf);
+}
+
+NCURSES_EXPORT(const char *)
+_nc_viswbuf2(int bufnum, const wchar_t *buf)
+{
+    return _nc_viswbuf2n(bufnum, buf, -1);
+}
+
+NCURSES_EXPORT(const char *)
+_nc_viswbuf(const wchar_t *buf)
+{
+    return _nc_viswbuf2(0, buf);
+}
+
+NCURSES_EXPORT(const char *)
+_nc_viswbufn(const wchar_t *buf, int len)
+{
+    return _nc_viswbuf2n(0, buf, len);
+}
+
+/* this special case is used for wget_wstr() */
+NCURSES_EXPORT(const char *)
+_nc_viswibuf(const wint_t *buf)
+{
+    static wchar_t *mybuf;
+    static unsigned mylen;
+    unsigned n;
+
+    for (n = 0; buf[n] != 0; ++n) ;
+    if (mylen < ++n) {
+	mylen = n + 80;
+	if (mybuf != 0)
+	    mybuf = typeRealloc(wchar_t, mylen, mybuf);
+	else
+	    mybuf = typeMalloc(wchar_t, mylen);
+    }
+    for (n = 0; buf[n] != 0; ++n)
+	mybuf[n] = (wchar_t) buf[n];
+
+    return _nc_viswbuf2(0, mybuf);
+}
+#endif /* USE_WIDEC_SUPPORT */
+
+/* use these functions for displaying parts of a line within a window */
+NCURSES_EXPORT(const char *)
+_nc_viscbuf2(int bufnum, const NCURSES_CH_T * buf, int len)
+{
+    char *result = _nc_trace_buf(bufnum, BUFSIZ);
+    int first;
+    const char *found;
+
+    if (result != 0) {
+#if USE_WIDEC_SUPPORT
+	if (len < 0)
+	    len = _nc_wchstrlen(buf);
+#endif /* USE_WIDEC_SUPPORT */
+
+	/*
+	 * Display one or more strings followed by attributes.
+	 */
+	first = 0;
+	while (first < len) {
+	    attr_t attr = AttrOf(buf[first]);
+	    int last = len - 1;
+	    int j;
+
+	    for (j = first + 1; j < len; ++j) {
+		if (!SameAttrOf(buf[j], buf[first])) {
+		    last = j - 1;
+		    break;
+		}
+	    }
+
+	    result = _nc_trace_bufcat(bufnum, l_brace);
+	    result = _nc_trace_bufcat(bufnum, d_quote);
+	    for (j = first; j <= last; ++j) {
+		found = _nc_altcharset_name(attr, (chtype) CharOf(buf[j]));
+		if (found != 0) {
+		    result = _nc_trace_bufcat(bufnum, found);
+		    attr &= ~A_ALTCHARSET;
+		} else
+#if USE_WIDEC_SUPPORT
+		if (!isWidecExt(buf[j])) {
+		    PUTC_DATA;
+
+		    PUTC_INIT;
+		    for (PUTC_i = 0; PUTC_i < CCHARW_MAX; ++PUTC_i) {
+			int k;
+
+			PUTC_ch = buf[j].chars[PUTC_i];
+			if (PUTC_ch == L'\0')
+			    break;
+			PUTC_n = (int) wcrtomb(PUTC_buf, buf[j].chars[PUTC_i], &PUT_st);
+			if (PUTC_n <= 0)
+			    break;
+			for (k = 0; k < PUTC_n; k++) {
+			    char temp[80];
+			    _nc_vischar(temp, UChar(PUTC_buf[k]));
+			    result = _nc_trace_bufcat(bufnum, temp);
+			}
+		    }
+		}
+#else
+		{
+		    char temp[80];
+		    _nc_vischar(temp, UChar(buf[j]));
+		    result = _nc_trace_bufcat(bufnum, temp);
+		}
+#endif /* USE_WIDEC_SUPPORT */
+	    }
+	    result = _nc_trace_bufcat(bufnum, d_quote);
+	    if (attr != A_NORMAL) {
+		result = _nc_trace_bufcat(bufnum, " | ");
+		result = _nc_trace_bufcat(bufnum, _traceattr2(bufnum + 20, attr));
+	    }
+	    result = _nc_trace_bufcat(bufnum, r_brace);
+	    first = last + 1;
+	}
+    }
+    return result;
+}
+
+NCURSES_EXPORT(const char *)
+_nc_viscbuf(const NCURSES_CH_T * buf, int len)
+{
+    return _nc_viscbuf2(0, buf, len);
+}
+#endif /* TRACE */
