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