syslog.c revision 1.7 1 #include <sys/types.h>
2 #include <sys/syslog.h>
3 #include <stdio.h>
4 #include <string.h>
5 #include <errno.h>
6 #include <stdarg.h>
7
8 void
9 openlog(const char *path, int opt, int fac)
10 {
11 }
12
13 void
14 closelog(void)
15 {
16 }
17
18 int
19 setlogmask(int mask)
20 {
21 return 0xff;
22 }
23
24 __strong_alias(_syslog, syslog)
25 void
26 syslog(int fac, const char *fmt, ...)
27 {
28 va_list ap;
29 va_start(ap, fmt);
30 vsyslog(fac, fmt, ap);
31 va_end(ap);
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 /* Cheap hack to ensure %m causes error message string to be shown */
40 if (strstr(fmt, "%m"))
41 (void)fprintf(stderr, " (%s)", strerror(errno));
42 (void)fprintf(stderr, "\n");
43 fflush(stderr);
44 }
45
46 void syslog_ss(int, struct syslog_data *, const char *, ...);
47 __strong_alias(_syslog_ss, syslog_ss)
48 void
49 syslog_ss(int priority, struct syslog_data *data, const char *fmt, ...)
50 {
51 va_list ap;
52 va_start(ap, fmt);
53 vsyslog(priority, fmt, ap);
54 va_end(ap);
55 }
56
57 void vsyslog_ss(int, struct syslog_data *, const char *, va_list);
58 __strong_alias(_vsyslog_ss, vsyslog_ss)
59 void
60 vsyslog_ss(int priority, struct syslog_data *data, const char *fmt, va_list ap)
61 {
62 vsyslog(priority, fmt, ap);
63 }
64
65 __strong_alias(_syslog_r, syslog_r)
66 void
67 syslog_r(int priority, struct syslog_data *data, const char *fmt, ...)
68 {
69 va_list ap;
70 va_start(ap, fmt);
71 vsyslog(priority, fmt, ap);
72 va_end(ap);
73 }
74
75 __strong_alias(_vsyslog_r, vsyslog_r)
76 void
77 vsyslog_r(int priority, struct syslog_data *data, const char *fmt, va_list ap)
78 {
79 vsyslog(priority, fmt, ap);
80 }
81
82 __strong_alias(_closelog_r, closelog_r)
83 void
84 closelog_r(struct syslog_data *data)
85 {
86 }
87
88 __strong_alias(_setlogmask_r, setlogmask_r)
89 int
90 setlogmask_r(int maskpri, struct syslog_data *data)
91 {
92 return 0xff;
93 }
94
95 __strong_alias(_openlog_r, openlog_r)
96 void
97 openlog_r(const char *id, int logopt, int facility, struct syslog_data *data)
98 {
99 }
100