Deleted Added
full compact
debug.c (302408) debug.c (369186)
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
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__)
12# include <stdarg.h>
11# include <stdarg.h>
13#else
14# include <varargs.h>
15#endif
16#include <stdio.h>
17
18#include "ipf.h"
19#include "opts.h"
20
21int debuglevel = 0;
22
23
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, ...)
32{
33 va_list pvar;
34
35 va_start(pvar, fmt);
36
37 if ((debuglevel > 0) && (level <= debuglevel))
38 vfprintf(stderr, fmt, pvar);
39 va_end(pvar);
40}
41
42
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, ...)
50{
51 va_list pvar;
52
53 va_start(pvar, fmt);
54
55 if (opts & OPT_DEBUG)
56 debug(0x1fffffff, fmt, pvar);
57 va_end(pvar);
58}
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}