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