summaryrefslogtreecommitdiff
path: root/sbin/ipf/libipf/debug.c
blob: 9fcdf98317bd6d81d005cd0755a95c9d0319d801 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

/*
 * Copyright (C) 2012 by Darren Reed.
 *
 * See the IPFILTER.LICENCE file for details on licencing.
 *
 * $Id$
 */

# include <stdarg.h>
#include <stdio.h>

#include "ipf.h"
#include "opts.h"

int	debuglevel = 0;


void
debug(int level, char *fmt, ...)
{
	va_list pvar;

	va_start(pvar, fmt);

	if ((debuglevel > 0) && (level <= debuglevel))
		vfprintf(stderr, fmt, pvar);
	va_end(pvar);
}


void
ipfkdebug(char *fmt, ...)
{
	va_list pvar;

	va_start(pvar, fmt);

	if (opts & OPT_DEBUG)
		debug(0x1fffffff, fmt, pvar);
	va_end(pvar);
}