3eb244d801
sys/stdarg.h and expect compiler to provide proper builtins, defaulting to the GCC interface. lint still has a special fallback. Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and derive va_list as required by standards.
71 lines
1.1 KiB
C
71 lines
1.1 KiB
C
/* $NetBSD: fakelog.c,v 1.6 2011/07/17 20:54:55 joerg Exp $ */
|
|
|
|
/*
|
|
* This module intercepts syslog() library calls and redirects their output
|
|
* to the standard output stream. For interactive testing.
|
|
*
|
|
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
|
|
*/
|
|
|
|
#include <sys/cdefs.h>
|
|
#ifndef lint
|
|
#if 0
|
|
static char sccsid[] = "@(#) fakelog.c 1.3 94/12/28 17:42:21";
|
|
#else
|
|
__RCSID("$NetBSD: fakelog.c,v 1.6 2011/07/17 20:54:55 joerg Exp $");
|
|
#endif
|
|
#endif
|
|
|
|
#include <stdio.h>
|
|
#include <syslog.h>
|
|
|
|
#include "mystdarg.h"
|
|
#include "percent_m.h"
|
|
|
|
/* openlog - dummy */
|
|
|
|
/* ARGSUSED */
|
|
|
|
void
|
|
openlog(name, logopt, facility)
|
|
const char *name;
|
|
int logopt;
|
|
int facility;
|
|
{
|
|
/* void */
|
|
}
|
|
|
|
/* vsyslog - format one record */
|
|
|
|
void
|
|
vsyslog(int severity, const char *fmt, va_list ap)
|
|
{
|
|
char buf[BUFSIZ];
|
|
|
|
vprintf(percent_m(buf, fmt), ap);
|
|
printf("\n");
|
|
fflush(stdout);
|
|
}
|
|
|
|
/* syslog - format one record */
|
|
|
|
/* VARARGS */
|
|
|
|
void
|
|
syslog(int severity, const char *fmt, ...)
|
|
{
|
|
va_list ap;
|
|
|
|
va_start(ap, fmt);
|
|
vsyslog(severity, fmt, ap);
|
|
va_end(ap);
|
|
}
|
|
|
|
/* closelog - dummy */
|
|
|
|
void
|
|
closelog()
|
|
{
|
|
/* void */
|
|
}
|