xref: /onnv-gate/usr/src/cmd/ipf/lib/common/debug.c (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * Copyright (C) 1993-2001 by Darren Reed.
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * See the IPFILTER.LICENCE file for details on licencing.
5*0Sstevel@tonic-gate  *
6*0Sstevel@tonic-gate  * $Id: debug.c,v 1.6 2001/06/09 17:09:24 darrenr Exp $
7*0Sstevel@tonic-gate  */
8*0Sstevel@tonic-gate 
9*0Sstevel@tonic-gate #if defined(__STDC__)
10*0Sstevel@tonic-gate # include <stdarg.h>
11*0Sstevel@tonic-gate #else
12*0Sstevel@tonic-gate # include <varargs.h>
13*0Sstevel@tonic-gate #endif
14*0Sstevel@tonic-gate #include <stdio.h>
15*0Sstevel@tonic-gate 
16*0Sstevel@tonic-gate #include "ipt.h"
17*0Sstevel@tonic-gate #include "opts.h"
18*0Sstevel@tonic-gate 
19*0Sstevel@tonic-gate 
20*0Sstevel@tonic-gate #ifdef	__STDC__
debug(char * fmt,...)21*0Sstevel@tonic-gate void	debug(char *fmt, ...)
22*0Sstevel@tonic-gate #else
23*0Sstevel@tonic-gate void	debug(fmt, va_alist)
24*0Sstevel@tonic-gate char *fmt;
25*0Sstevel@tonic-gate va_dcl
26*0Sstevel@tonic-gate #endif
27*0Sstevel@tonic-gate {
28*0Sstevel@tonic-gate 	va_list pvar;
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate 	va_start(pvar, fmt);
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate 	if (opts & OPT_DEBUG)
33*0Sstevel@tonic-gate 		vprintf(fmt, pvar);
34*0Sstevel@tonic-gate 	va_end(pvar);
35*0Sstevel@tonic-gate }
36