xref: /netbsd-src/distrib/utils/libhack/syslog.c (revision b1c86f5f087524e68db12794ee9c3e3da1ab17a0)
1 #include <sys/types.h>
2 #include <sys/syslog.h>
3 #include <stdio.h>
4 #include <stdarg.h>
5 
6 void
7 openlog(const char *path, int opt, int fac)
8 {
9 }
10 
11 void
12 closelog(void)
13 {
14 }
15 
16 int
17 setlogmask(int mask)
18 {
19 	return 0xff;
20 }
21 
22 __strong_alias(_syslog, syslog)
23 void
24 syslog(int fac, const char *fmt, ...)
25 {
26 	va_list ap;
27 	va_start(ap, fmt);
28 	(void)vfprintf(stderr, fmt, ap);
29 	va_end(ap);
30 	(void)fprintf(stderr, "\n");
31 	fflush(stderr);
32 }
33 
34 __strong_alias(_vsyslog, vsyslog)
35 void
36 vsyslog(int fac, const char *fmt, va_list ap)
37 {
38 	(void)vfprintf(stderr, fmt, ap);
39 	(void)fprintf(stderr, "\n");
40 	fflush(stderr);
41 }
42 
43 void syslog_ss(int, struct syslog_data *, const char *, ...);
44 __strong_alias(_syslog_ss, syslog_ss)
45 void
46 syslog_ss(int priority, struct syslog_data *data, const char *fmt, ...)
47 {
48 	va_list ap;
49 	va_start(ap, fmt);
50 	vsyslog(priority, fmt, ap);
51 	va_end(ap);
52 }
53 
54 void vsyslog_ss(int, struct syslog_data *, const char *, va_list);
55 __strong_alias(_vsyslog_ss, vsyslog_ss)
56 void
57 vsyslog_ss(int priority, struct syslog_data *data, const char *fmt, va_list ap)
58 {
59 	vsyslog(priority, fmt, ap);
60 }
61 
62 __strong_alias(_syslog_r, syslog_r)
63 void
64 syslog_r(int priority, struct syslog_data *data, const char *fmt, ...)
65 {
66 	va_list ap;
67 	va_start(ap, fmt);
68 	vsyslog(priority, fmt, ap);
69 	va_end(ap);
70 }
71 
72 __strong_alias(_vsyslog_r, vsyslog_r)
73 void
74 vsyslog_r(int priority, struct syslog_data *data, const char *fmt, va_list ap)
75 {
76 	vsyslog(priority, fmt, ap);
77 }
78 
79 __strong_alias(_closelog_r, closelog_r)
80 void
81 closelog_r(struct syslog_data *data)
82 {
83 }
84 
85 __strong_alias(_setlogmask_r, setlogmask_r)
86 int
87 setlogmask_r(int maskpri, struct syslog_data *data)
88 {
89 	return 0xff;
90 }
91 
92 __strong_alias(_openlog_r, openlog_r)
93 void
94 openlog_r(const char *id, int logopt, int facility, struct syslog_data *data)
95 {
96 }
97