xref: /onnv-gate/usr/src/cmd/tcpd/myvsyslog.c (revision 0:68f95e015346)
1*0Sstevel@tonic-gate  /*
2*0Sstevel@tonic-gate   * vsyslog() for sites without. In order to enable this code, build with
3*0Sstevel@tonic-gate   * -Dvsyslog=myvsyslog. We use a different name so that no accidents will
4*0Sstevel@tonic-gate   * happen when vsyslog() exists. On systems with vsyslog(), syslog() is
5*0Sstevel@tonic-gate   * typically implemented in terms of vsyslog().
6*0Sstevel@tonic-gate   *
7*0Sstevel@tonic-gate   * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
8*0Sstevel@tonic-gate   */
9*0Sstevel@tonic-gate 
10*0Sstevel@tonic-gate #ifndef lint
11*0Sstevel@tonic-gate static char sccsid[] = "@(#) myvsyslog.c 1.1 94/12/28 17:42:33";
12*0Sstevel@tonic-gate #endif
13*0Sstevel@tonic-gate 
14*0Sstevel@tonic-gate #ifdef vsyslog
15*0Sstevel@tonic-gate 
16*0Sstevel@tonic-gate #include <stdio.h>
17*0Sstevel@tonic-gate 
18*0Sstevel@tonic-gate #include "tcpd.h"
19*0Sstevel@tonic-gate #include "mystdarg.h"
20*0Sstevel@tonic-gate 
myvsyslog(severity,format,ap)21*0Sstevel@tonic-gate myvsyslog(severity, format, ap)
22*0Sstevel@tonic-gate int     severity;
23*0Sstevel@tonic-gate char   *format;
24*0Sstevel@tonic-gate va_list ap;
25*0Sstevel@tonic-gate {
26*0Sstevel@tonic-gate     char    fbuf[BUFSIZ];
27*0Sstevel@tonic-gate     char    obuf[3 * STRING_LENGTH];
28*0Sstevel@tonic-gate 
29*0Sstevel@tonic-gate     vsprintf(obuf, percent_m(fbuf, format), ap);
30*0Sstevel@tonic-gate     syslog(severity, "%s", obuf);
31*0Sstevel@tonic-gate }
32*0Sstevel@tonic-gate 
33*0Sstevel@tonic-gate #endif
34