- _tracef("TRACING NCURSES version %s (%d)",
- NCURSES_VERSION, NCURSES_VERSION_PATCH);
- }
-}
-#endif
-
-const char *
-_nc_visbuf2(int bufnum, const char *buf)
-/* visibilize a given string */
-{
- char *vbuf;
- char *tp;
- int c;
-
- if (buf == 0)
- return ("(null)");
- 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 == '"') {
- *tp++ = '\\';
- *tp++ = '"';
- } else if (is7bits(c) && (isgraph(c) || c == ' ')) {
- *tp++ = 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 (is7bits(c) && iscntrl(c)) {
- *tp++ = '\\';
- *tp++ = '^';
- *tp++ = '@' + c;
- } else {
- sprintf(tp, "\\%03o", c & 0xff);
- tp += strlen(tp);
+ _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;