summaryrefslogtreecommitdiff
path: root/lib/ccdbg-debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ccdbg-debug.c')
-rw-r--r--lib/ccdbg-debug.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/ccdbg-debug.c b/lib/ccdbg-debug.c
index 847361c7..6eb4e0c5 100644
--- a/lib/ccdbg-debug.c
+++ b/lib/ccdbg-debug.c
@@ -34,11 +34,20 @@ ccdbg_clear_debug(int level)
ccdbg_level &= ~level;
}
+static int initialized;
+
void
ccdbg_debug(int level, char *format, ...)
{
va_list ap;
+ if (!initialized) {
+ char *level;
+ initialized = 1;
+ level = getenv("CCDEBUG");
+ if (level)
+ ccdbg_level |= strtoul(level, NULL, 0);
+ }
if (ccdbg_level & level) {
va_start(ap, format);
vprintf(format, ap);