Change debug handling, now we write debug out iff CURSES_TRACE_FILE

has been set in the environment, this prevents people using MKDEBUGLIB
getting more than they bargained for.

Tidied up the debug settings in the Makefile to reflect the above change,
we no longer need to have FULL_DEBUG since nothing is written by default.
This commit is contained in:
blymn 2007-05-29 13:20:21 +00:00
parent 82e46da13f
commit eaa84a63c0
2 changed files with 12 additions and 15 deletions

View File

@ -1,16 +1,11 @@
# $NetBSD: Makefile,v 1.53 2007/05/28 15:01:53 blymn Exp $
# $NetBSD: Makefile,v 1.54 2007/05/29 13:20:21 blymn Exp $
# @(#)Makefile 8.2 (Berkeley) 1/2/94
.include <bsd.own.mk>
CPPFLAGS+=#-DTFILE=\"/dev/ttyp0\"
CPPFLAGS+=-I${.CURDIR} -I${NETBSDSRCDIR}/lib/libterm
.if defined(DEBUG_CURSES)
CFLAGS+=-g
CPPFLAGS+=-g
.if defined(FULL_DEBUG)
CPPFLAGS+=-DDEBUG
.endif
CPPFLAGS+=-g -DDEBUG
.endif
.if defined(SMALL)
CPPFLAGS+=-DSMALL

View File

@ -1,4 +1,4 @@
/* $NetBSD: ctrace.c,v 1.18 2007/01/22 21:14:53 jdc Exp $ */
/* $NetBSD: ctrace.c,v 1.19 2007/05/29 13:20:21 blymn Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)ctrace.c 8.2 (Berkeley) 10/5/93";
#else
__RCSID("$NetBSD: ctrace.c,v 1.18 2007/01/22 21:14:53 jdc Exp $");
__RCSID("$NetBSD: ctrace.c,v 1.19 2007/05/29 13:20:21 blymn Exp $");
#endif
#endif /* not lint */
@ -49,10 +49,6 @@ __RCSID("$NetBSD: ctrace.c,v 1.18 2007/01/22 21:14:53 jdc Exp $");
#include "curses.h"
#include "curses_private.h"
#ifndef TFILE
#define TFILE "__curses.out"
#endif
static FILE *tracefp = NULL; /* Curses debugging file descriptor. */
static int tracemask; /* Areas of trace output we want. */
@ -74,9 +70,15 @@ __CTRACE_init()
tracemask = (0 - tracemask) ^ __CTRACE_ALL;
if (tracemask == 0)
return;
tf = getenv("CURSES_TRACE_FILE");
if (tf == NULL || strcmp( tf, "<none>"))
tracefp = fopen(tf ? tf : TFILE, "w");
if ((tf != NULL) && !strcmp( tf, "<none>"))
tf = NULL;
if (tf != NULL)
tracefp = fopen(tf, "w");
init_done = 1;
__CTRACE(__CTRACE_ALL, "Trace mask: 0x%08x\n", tracemask);
}