#ifndef lint
static char sccsid[] = "@(#) diag.c 1.1 94/12/28 17:42:20";
#endif
#include <syslog.h>
#include <stdio.h>
#include <setjmp.h>
#include "tcpd.h"
#include "mystdarg.h"
struct tcpd_context tcpd_context;
jmp_buf tcpd_buf;
static void tcpd_diag(severity, tag, format, ap)
int severity;
char *tag;
char *format;
va_list ap;
{
char fmt[BUFSIZ];
if (tcpd_context.file)
sprintf(fmt, "%s: %s, line %d: %s",
tag, tcpd_context.file, tcpd_context.line, format);
else
sprintf(fmt, "%s: %s", tag, format);
vsyslog(severity, fmt, ap);
}
void VARARGS(tcpd_warn, char *, format)
{
va_list ap;
VASTART(ap, char *, format);
tcpd_diag(LOG_ERR, "warning", format, ap);
VAEND(ap);
}
void VARARGS(tcpd_jump, char *, format)
{
va_list ap;
VASTART(ap, char *, format);
tcpd_diag(LOG_ERR, "error", format, ap);
VAEND(ap);
longjmp(tcpd_buf, AC_ERROR);
}