xref: /netbsd-src/usr.sbin/tcpdchk/fakelog.c (revision ba65fde2d7fefa7d39838fa5fa855e62bd606b5e)
1 /*	$NetBSD: fakelog.c,v 1.6 2011/07/17 20:54:55 joerg Exp $	*/
2 
3  /*
4   * This module intercepts syslog() library calls and redirects their output
5   * to the standard output stream. For interactive testing.
6   *
7   * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
8   */
9 
10 #include <sys/cdefs.h>
11 #ifndef lint
12 #if 0
13 static char sccsid[] = "@(#) fakelog.c 1.3 94/12/28 17:42:21";
14 #else
15 __RCSID("$NetBSD: fakelog.c,v 1.6 2011/07/17 20:54:55 joerg Exp $");
16 #endif
17 #endif
18 
19 #include <stdio.h>
20 #include <syslog.h>
21 
22 #include "mystdarg.h"
23 #include "percent_m.h"
24 
25 /* openlog - dummy */
26 
27 /* ARGSUSED */
28 
29 void
30 openlog(name, logopt, facility)
31 const char   *name;
32 int     logopt;
33 int     facility;
34 {
35     /* void */
36 }
37 
38 /* vsyslog - format one record */
39 
40 void
41 vsyslog(int severity, const char *fmt, va_list ap)
42 {
43     char    buf[BUFSIZ];
44 
45     vprintf(percent_m(buf, fmt), ap);
46     printf("\n");
47     fflush(stdout);
48 }
49 
50 /* syslog - format one record */
51 
52 /* VARARGS */
53 
54 void
55 syslog(int severity, const char *fmt, ...)
56 {
57     va_list ap;
58 
59     va_start(ap, fmt);
60     vsyslog(severity, fmt, ap);
61     va_end(ap);
62 }
63 
64 /* closelog - dummy */
65 
66 void
67 closelog()
68 {
69     /* void */
70 }
71