Deleted Added
full compact
1/* $FreeBSD: stable/11/contrib/ipfilter/lib/debug.c 255332 2013-09-06 23:11:19Z cy $ */
1/* $FreeBSD: stable/11/contrib/ipfilter/lib/debug.c 369186 2021-01-31 04:32:46Z cy $ */
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#if defined(__STDC__)
11# include <stdarg.h>
13#else
14# include <varargs.h>
15#endif
12#include <stdio.h>
13
14#include "ipf.h"
15#include "opts.h"
16
17int debuglevel = 0;
18
19
24#ifdef __STDC__
25void debug(int level, char *fmt, ...)
26#else
27void debug(level, fmt, va_alist)
28 int level;
29 char *fmt;
30 va_dcl
31#endif
20void
21debug(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
43#ifdef __STDC__
44void ipfkdebug(char *fmt, ...)
45#else
46void ipfkdebug(fmt, va_alist)
47 char *fmt;
48 va_dcl
49#endif
33void
34ipfkdebug(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}