/* debugging redirected to squid (DW approach) */
#ifdef __STDC__
-void (*snmplib_debug) (int,...);
+void (*snmplib_debug_hook) (int,char *,...);
#else
-void (*snmplib_debug) (va_alist));
+void (*snmplib_debug_hook) (va_alist);
#endif
/* mib stuff here */
#ifndef SQUID_H
#ifdef __STDC__
-extern void (*snmplib_debug) (int,char *,...);
+extern void snmplib_debug(int,char *,...);
+extern void (*snmplib_debug_hook) (int,char *,...);
#else
-extern void (*snmplib_debug) (va_alist);
+extern void snmplib_debug(va_alist);
+extern void (*snmplib_debug_hook) (va_alist);
#endif
#endif
coexistance.c snmp_api.c snmp_error.c \
mib.c snmp_api_error.c \
mibii.c snmp_api_util.c snmp_msg.c \
- snmp_pdu.c
+ snmp_pdu.c snmplib_debug.c
OBJS = asn1.o parse.o snmp_dump.o snmp_vars.o \
coexistance.o snmp_api.o snmp_error.o \
mib.o snmp_api_error.o \
mibii.o snmp_api_util.o snmp_msg.o \
- snmp_pdu.o
+ snmp_pdu.o snmplib_debug.o
CC = @CC@
AR_R = @AR_R@
void init_mib(char *file)
{
- if (snmplib_debug != NULL)
- snmplib_debug(6, "init_mib: Called.\n");
+ snmplib_debug(6, "init_mib: Called.\n");
if (Mib != NULL)
return;
int type;
{
assert(string != NULL);
- assert(snmplib_debug != NULL);
if (type == ENDOFFILE)
snmplib_debug(0, "%s(EOF): On or around line %d\n", string, Line);
else if (token)
--- /dev/null
+#include "config.h"
+#if HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#include "snmp_debug.h"
+
+extern void
+#ifdef __STDC__
+snmplib_debug(int lvl,char *fmt,...)
+{
+ va_list args;
+ va_start(args, fmt);
+#else
+snmplib_debug(va_alist)
+ va_dcl
+{
+ va_list args;
+ int lvl;
+ char char *fmt;
+ va_start(args);
+ lvl = va_arg(args, int);
+ fmt = va_arg(args, char *);
+#endif
+ if (snmplib_debug_hook != NULL)
+ snmplib_debug_hook(lvl, fmt, args);
+ else
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+}
+