summaryrefslogtreecommitdiff
path: root/lib/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/debug.c')
-rw-r--r--lib/debug.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/lib/debug.c b/lib/debug.c
index 144bc0231a06c..c442983b4f23a 100644
--- a/lib/debug.c
+++ b/lib/debug.c
@@ -1,9 +1,9 @@
/*
- * Copyright (C) 2000-2001 by Darren Reed.
+ * Copyright (C) 2012 by Darren Reed.
*
* See the IPFILTER.LICENCE file for details on licencing.
*
- * $Id: debug.c,v 1.6.4.1 2006/06/16 17:20:57 darrenr Exp $
+ * $Id$
*/
#if defined(__STDC__)
@@ -13,16 +13,37 @@
#endif
#include <stdio.h>
-#include "ipt.h"
+#include "ipf.h"
#include "opts.h"
+int debuglevel = 0;
+
+
+#ifdef __STDC__
+void debug(int level, char *fmt, ...)
+#else
+void debug(level, fmt, va_alist)
+ int level;
+ char *fmt;
+ va_dcl
+#endif
+{
+ va_list pvar;
+
+ va_start(pvar, fmt);
+
+ if ((debuglevel > 0) && (level <= debuglevel))
+ vfprintf(stderr, fmt, pvar);
+ va_end(pvar);
+}
+
#ifdef __STDC__
-void debug(char *fmt, ...)
+void ipfkdebug(char *fmt, ...)
#else
-void debug(fmt, va_alist)
-char *fmt;
-va_dcl
+void ipfkdebug(fmt, va_alist)
+ char *fmt;
+ va_dcl
#endif
{
va_list pvar;
@@ -30,6 +51,6 @@ va_dcl
va_start(pvar, fmt);
if (opts & OPT_DEBUG)
- vprintf(fmt, pvar);
+ debug(0x1fffffff, fmt, pvar);
va_end(pvar);
}