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