1999-12-09 23:15:14 +00:00
|
|
|
#ifndef DEBUG_H
|
|
|
|
|
#define DEBUG_H
|
|
|
|
|
|
2002-05-11 18:19:39 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
2001-05-25 03:14:27 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2007-06-17 10:20:55 +00:00
|
|
|
#include "config.h"
|
2001-05-25 03:14:27 +00:00
|
|
|
#endif
|
2001-04-27 02:20:38 +00:00
|
|
|
|
2001-11-11 19:18:28 +00:00
|
|
|
/* DEBUGGING
|
|
|
|
|
To enable the debug() function on all of the software, just type:
|
|
|
|
|
./configure --enable-debug
|
|
|
|
|
and recompile with 'make'
|
|
|
|
|
|
|
|
|
|
To enable the debug() function only in specific files:
|
|
|
|
|
1) Configure without enabling debug (that is without --enable-debug)
|
|
|
|
|
2) Edit the source file that you want to debug and put this:
|
|
|
|
|
#define DEBUG
|
|
|
|
|
#include "shared/debug.h"
|
|
|
|
|
#undef DEBUG
|
|
|
|
|
Then recompile with 'make'
|
|
|
|
|
This way, the global DEBUG macro is off but is locally enabled in
|
|
|
|
|
certains parts of the software.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
static inline void debug(const char *format, .../*args*/) {
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
va_list ap;
|
|
|
|
|
va_start(ap, format);
|
|
|
|
|
vfprintf(stderr, format, ap);
|
|
|
|
|
va_end(ap);
|
|
|
|
|
#endif /*DEBUG*/
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-09 23:15:14 +00:00
|
|
|
#endif
|