X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=lib%2Fccdbg-debug.c;fp=lib%2Fccdbg-debug.c;h=6eb4e0c5d4343a5d20dbd81ae9f0f50b9156e33f;hp=847361c7bf142b9717c638260a11007863d7154f;hb=2d9b8a83a2d9f495199033e43f519d26f27938fe;hpb=24edd56155ed0fa02fdd8f66fdc7aa5a1021bf7d 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);