2 /***************************************************************************
4 ****************************************************************************
5 * ncurses is copyright (C) 1992-1995 *
7 * zmbenhal@netcom.com *
9 * esr@snark.thyrsus.com *
11 * Permission is hereby granted to reproduce and distribute ncurses *
12 * by any means and for any fee, whether alone or as part of a *
13 * larger distribution, in source or in binary form, PROVIDED *
14 * this notice is included with any such distribution, and is not *
15 * removed from any of its header files. Mention of ncurses in any *
16 * applications linked with it is highly appreciated. *
18 * ncurses comes AS IS with no warranty, implied or expressed. *
20 ***************************************************************************/
25 * lib_tracechr.c - Tracing/Debugging routines
29 #define TRACE /* turn on internal defs for this module */
32 #include <curses.priv.h>
36 char *_tracechar(const unsigned char ch)
40 * We can show the actual character if it's either an ordinary printable
41 * or one of the high-half characters.
43 if (isprint(ch) || (ch & 0x80))
46 crep[1] = ch; /* necessary; printf tries too hard on metachars */
47 (void) sprintf(crep + 2, "' = 0x%02x", (unsigned)ch);
50 (void) sprintf(crep, "0x%02x", (unsigned)ch);