From b3af872f3c9e4547ea27d914a463bb5e63f6fd07 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 12 Jan 2010 23:32:22 +0000 Subject: [PATCH] Patch from James H: make the Windows debugging output conditional on an enabling environment variable. [originally from svn r8834] --- windows.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/windows.c b/windows.c index d2044cc..7bdb5e2 100644 --- a/windows.c +++ b/windows.c @@ -154,11 +154,17 @@ void debug_printf(char *fmt, ...) { char buf[4096]; va_list ap; + static int debugging = -1; - va_start(ap, fmt); - _vsnprintf(buf, 4095, fmt, ap); - dputs(buf); - va_end(ap); + if (debugging == -1) + debugging = getenv("DEBUG_PUZZLES") ? 1 : 0; + + if (debugging) { + va_start(ap, fmt); + _vsnprintf(buf, 4095, fmt, ap); + dputs(buf); + va_end(ap); + } } #endif