enable debugging functions when taskdebuglevel is set

This commit is contained in:
David du Colombier 2014-08-03 18:43:01 +02:00
parent b0c00d19fb
commit 0d454584f8

11
task.c
View File

@ -31,11 +31,12 @@ taskdebug(char *fmt, ...)
char *p; char *p;
static int fd = -1; static int fd = -1;
return; if(taskdebuglevel == 0)
return;
va_start(arg, fmt); va_start(arg, fmt);
vfprint(1, fmt, arg); vfprint(1, fmt, arg);
va_end(arg); va_end(arg);
return;
if(fd < 0){ if(fd < 0){
p = strrchr(argv0, '/'); p = strrchr(argv0, '/');
@ -278,6 +279,9 @@ taskname(char *fmt, ...)
va_list arg; va_list arg;
Task *t; Task *t;
if(taskdebuglevel == 0)
return;
t = taskrunning; t = taskrunning;
va_start(arg, fmt); va_start(arg, fmt);
vsnprint(t->name, sizeof t->name, fmt, arg); vsnprint(t->name, sizeof t->name, fmt, arg);
@ -296,6 +300,9 @@ taskstate(char *fmt, ...)
va_list arg; va_list arg;
Task *t; Task *t;
if(taskdebuglevel == 0)
return;
t = taskrunning; t = taskrunning;
va_start(arg, fmt); va_start(arg, fmt);
vsnprint(t->state, sizeof t->name, fmt, arg); vsnprint(t->state, sizeof t->name, fmt, arg);