* lib_trace.c - Tracing/Debugging routines
*/
-#ifndef TRACE
-#define TRACE /* turn on internal defs for this module */
-#endif
-
#include <curses.priv.h>
+#include <tic.h>
-MODULE_ID("$Id: lib_trace.c,v 1.25 1998/02/11 12:13:55 tom Exp $")
+MODULE_ID("$Id: lib_trace.c,v 1.30 1998/10/03 23:41:42 tom Exp $")
#include <ctype.h>
#if HAVE_FCNTL_H
#include <fcntl.h>
#endif
-unsigned _nc_tracing = 0;
+unsigned _nc_tracing = 0; /* always define this */
+
+#ifdef TRACE
const char *_nc_tputs_trace = "";
long _nc_outchars;
-int _nc_optimize_enable = OPTIMIZE_ALL;
static FILE * tracefp; /* default to writing to stderr */
+#endif
-void trace(const unsigned int tracelevel)
+void trace(const unsigned int tracelevel GCC_UNUSED)
{
+#ifdef TRACE
static bool been_here = FALSE;
+static char my_name[] = "trace";
_nc_tracing = tracelevel;
if (! been_here && tracelevel) {
been_here = TRUE;
- if ((tracefp = fopen("trace", "w")) == 0) {
+ if (_nc_access(my_name, W_OK) < 0
+ || (tracefp = fopen(my_name, "w")) == 0) {
perror("curses: Can't open 'trace' file: ");
exit(EXIT_FAILURE);
}
_tracef("TRACING NCURSES version %s (%d)",
NCURSES_VERSION, NCURSES_VERSION_PATCH);
}
+#endif
}
const char *_nc_visbuf2(int bufnum, const char *buf)
if (buf == 0)
return("(null)");
+ if (buf == CANCELLED_STRING)
+ return("(cancelled)");
tp = vbuf = _nc_trace_buf(bufnum, (strlen(buf) * 4) + 5);
*tp++ = '"';
return _nc_visbuf2(0, buf);
}
+#ifdef TRACE
void
_tracef(const char *fmt, ...)
{
T((T_RETURN("%p"), code));
return code;
}
+#endif /* TRACE */