xref: /dragonfly/contrib/tcp_wrappers/fakelog.c (revision 6e316fcd)
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 <stdarg.h>
9 #include <stdio.h>
10 
11 extern char *percent_m();
12 
13 /* openlog - dummy */
14 
15 /* ARGSUSED */
16 
17 void
18 openlog(name, logopt, facility)
19 char   *name;
20 int     logopt;
21 int     facility;
22 {
23     /* void */
24 }
25 
26 /* vsyslog - format one record */
27 
28 void
29 vsyslog(severity, fmt, ap)
30 int     severity;
31 char   *fmt;
32 va_list ap;
33 {
34     char    buf[BUFSIZ];
35 
36     vprintf(percent_m(buf, fmt), ap);
37     printf("\n");
38     fflush(stdout);
39 }
40 
41 /* syslog - format one record */
42 
43 /* VARARGS */
44 
45 void
46 syslog(int severity, const char *fmt, ...)
47 {
48     va_list ap;
49 
50     va_start(ap, fmt);
51     vsyslog(severity, fmt, ap);
52     va_end(ap);
53 }
54 
55 /* closelog - dummy */
56 
57 void
58 closelog()
59 {
60     /* void */
61 }
62