xref: /onnv-gate/usr/src/cmd/tcpd/fakelog.c (revision 0:68f95e015346)
1*0Sstevel@tonic-gate  /*
2*0Sstevel@tonic-gate   * This module intercepts syslog() library calls and redirects their output
3*0Sstevel@tonic-gate   * to the standard output stream. For interactive testing.
4*0Sstevel@tonic-gate   *
5*0Sstevel@tonic-gate   * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
6*0Sstevel@tonic-gate   */
7*0Sstevel@tonic-gate 
8*0Sstevel@tonic-gate #ifndef lint
9*0Sstevel@tonic-gate static char sccsid[] = "@(#) fakelog.c 1.3 94/12/28 17:42:21";
10*0Sstevel@tonic-gate #endif
11*0Sstevel@tonic-gate 
12*0Sstevel@tonic-gate #include <stdio.h>
13*0Sstevel@tonic-gate 
14*0Sstevel@tonic-gate #include "mystdarg.h"
15*0Sstevel@tonic-gate 
16*0Sstevel@tonic-gate /* openlog - dummy */
17*0Sstevel@tonic-gate 
18*0Sstevel@tonic-gate /* ARGSUSED */
19*0Sstevel@tonic-gate 
openlog(name,logopt,facility)20*0Sstevel@tonic-gate openlog(name, logopt, facility)
21*0Sstevel@tonic-gate char   *name;
22*0Sstevel@tonic-gate int     logopt;
23*0Sstevel@tonic-gate int     facility;
24*0Sstevel@tonic-gate {
25*0Sstevel@tonic-gate     /* void */
26*0Sstevel@tonic-gate }
27*0Sstevel@tonic-gate 
28*0Sstevel@tonic-gate /* vsyslog - format one record */
29*0Sstevel@tonic-gate 
vsyslog(severity,fmt,ap)30*0Sstevel@tonic-gate vsyslog(severity, fmt, ap)
31*0Sstevel@tonic-gate int     severity;
32*0Sstevel@tonic-gate char   *fmt;
33*0Sstevel@tonic-gate va_list ap;
34*0Sstevel@tonic-gate {
35*0Sstevel@tonic-gate     char    buf[BUFSIZ];
36*0Sstevel@tonic-gate 
37*0Sstevel@tonic-gate     vprintf(percent_m(buf, fmt), ap);
38*0Sstevel@tonic-gate     printf("\n");
39*0Sstevel@tonic-gate     fflush(stdout);
40*0Sstevel@tonic-gate }
41*0Sstevel@tonic-gate 
42*0Sstevel@tonic-gate /* syslog - format one record */
43*0Sstevel@tonic-gate 
44*0Sstevel@tonic-gate /* VARARGS */
45*0Sstevel@tonic-gate 
VARARGS(syslog,int,severity)46*0Sstevel@tonic-gate VARARGS(syslog, int, severity)
47*0Sstevel@tonic-gate {
48*0Sstevel@tonic-gate     va_list ap;
49*0Sstevel@tonic-gate     char   *fmt;
50*0Sstevel@tonic-gate 
51*0Sstevel@tonic-gate     VASTART(ap, int, severity);
52*0Sstevel@tonic-gate     fmt = va_arg(ap, char *);
53*0Sstevel@tonic-gate     vsyslog(severity, fmt, ap);
54*0Sstevel@tonic-gate     VAEND(ap);
55*0Sstevel@tonic-gate }
56*0Sstevel@tonic-gate 
57*0Sstevel@tonic-gate /* closelog - dummy */
58*0Sstevel@tonic-gate 
closelog()59*0Sstevel@tonic-gate closelog()
60*0Sstevel@tonic-gate {
61*0Sstevel@tonic-gate     /* void */
62*0Sstevel@tonic-gate }
63