xref: /dragonfly/contrib/tcp_wrappers/fakelog.c (revision 0de090e1)
1  /*
2   * This module intercepts syslog() library calls and redirects their output
3   * to the standard output stream. For interactive testing.
4   *
5   * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
6   */
7 
8 #include <stdio.h>
9 
10 #include "mystdarg.h"
11 
12 /* openlog - dummy */
13 
14 /* ARGSUSED */
15 
16 void
17 openlog(name, logopt, facility)
18 char   *name;
19 int     logopt;
20 int     facility;
21 {
22     /* void */
23 }
24 
25 /* vsyslog - format one record */
26 
27 void
28 vsyslog(severity, fmt, ap)
29 int     severity;
30 char   *fmt;
31 va_list ap;
32 {
33     char    buf[BUFSIZ];
34 
35     vprintf(percent_m(buf, fmt), ap);
36     printf("\n");
37     fflush(stdout);
38 }
39 
40 /* syslog - format one record */
41 
42 /* VARARGS */
43 
44 void
45 VARARGS(syslog, int, severity)
46 {
47     va_list ap;
48     char   *fmt;
49 
50     VASTART(ap, int, severity);
51     fmt = va_arg(ap, char *);
52     vsyslog(severity, fmt, ap);
53     VAEND(ap);
54 }
55 
56 /* closelog - dummy */
57 
58 void
59 closelog()
60 {
61     /* void */
62 }
63