Home | History | Annotate | Line # | Download | only in tcpdchk
fakelog.c revision 1.5
      1 /*	$NetBSD: fakelog.c,v 1.5 2002/07/06 21:46:59 wiz 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.5 2002/07/06 21:46:59 wiz 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 syslog(int severity, const char *fmt, ...)
     59 {
     60     va_list ap;
     61 
     62     va_start(ap, fmt);
     63     vsyslog(severity, fmt, ap);
     64     va_end(ap);
     65 }
     66 
     67 /* closelog - dummy */
     68 
     69 void
     70 closelog()
     71 {
     72     /* void */
     73 }
     74