add ob_debug for printing stuff only when debug is enabled
This commit is contained in:
parent
bcc090ec83
commit
d2a628a487
2 changed files with 29 additions and 0 deletions
21
openbox/debug.c
Normal file
21
openbox/debug.c
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#include <glib.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
static gboolean show;
|
||||||
|
|
||||||
|
void ob_debug_show_output(gboolean enable)
|
||||||
|
{
|
||||||
|
show = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ob_debug(char *a, ...)
|
||||||
|
{
|
||||||
|
va_list vl;
|
||||||
|
|
||||||
|
if (show) {
|
||||||
|
va_start(vl, a);
|
||||||
|
vfprintf(stderr, a, vl);
|
||||||
|
}
|
||||||
|
}
|
8
openbox/debug.h
Normal file
8
openbox/debug.h
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#ifndef __ob__debug_h
|
||||||
|
#define __ob__debug_h
|
||||||
|
|
||||||
|
void ob_debug_show_output(gboolean enable);
|
||||||
|
|
||||||
|
void ob_debug(char *a, ...);
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in a new issue