xref: /freebsd/contrib/tcp_wrappers/fakelog.c (revision 7ef62cebc2f965b0f640263e179276928885e33d)
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 #ifndef lint
9 static char sccsid[] = "@(#) fakelog.c 1.3 94/12/28 17:42:21";
10 #endif
11 
12 #include <stdio.h>
13 
14 #include "mystdarg.h"
15 
16 /* openlog - dummy */
17 
18 /* ARGSUSED */
19 
20 void openlog(char *name, int logopt, int facility)
21 {
22     /* void */
23 }
24 
25 /* vsyslog - format one record */
26 
27 void vsyslog(int severity, char *fmt, va_list ap)
28 {
29     char    buf[BUFSIZ];
30 
31     vprintf(percent_m(buf, fmt), ap);
32     printf("\n");
33     fflush(stdout);
34 }
35 
36 /* syslog - format one record */
37 
38 /* VARARGS */
39 
40 void VARARGS(syslog, int, severity)
41 {
42     va_list ap;
43     char   *fmt;
44 
45     VASTART(ap, int, severity);
46     fmt = va_arg(ap, char *);
47     vsyslog(severity, fmt, ap);
48     VAEND(ap);
49 }
50 
51 /* closelog - dummy */
52 
53 void closelog()
54 {
55     /* void */
56 }
57