1 /* $FreeBSD$ */
2
3 /*
4 * Copyright (C) 2012 by Darren Reed.
5 *
6 * See the IPFILTER.LICENCE file for details on licencing.
7 *
8 * $Id$
9 */
10
11 # include <stdarg.h>
12 #include <stdio.h>
13
14 #include "ipf.h"
15 #include "opts.h"
16
17 int debuglevel = 0;
18
19
20 void
debug(int level,char * fmt,...)21 debug(int level, char *fmt, ...)
22 {
23 va_list pvar;
24
25 va_start(pvar, fmt);
26
27 if ((debuglevel > 0) && (level <= debuglevel))
28 vfprintf(stderr, fmt, pvar);
29 va_end(pvar);
30 }
31
32
33 void
ipfkdebug(char * fmt,...)34 ipfkdebug(char *fmt, ...)
35 {
36 va_list pvar;
37
38 va_start(pvar, fmt);
39
40 if (opts & OPT_DEBUG)
41 debug(0x1fffffff, fmt, pvar);
42 va_end(pvar);
43 }
44