aboutsummaryrefslogtreecommitdiff
path: root/sbin/ipf/libipf/debug.c
blob: 0e3276e21705f4bc4e4b49283cb4fd2661a993b4 (plain) (blame)
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
43
/*	$FreeBSD$	*/

/*
 * 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);
}