Home | History | Annotate | Line # | Download | only in tcpdchk
      1 /*	$NetBSD: fakelog.c,v 1.7 2018/01/23 21:06:26 sevan 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.7 2018/01/23 21:06:26 sevan 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(const char *name, int logopt, int facility)
     31 {
     32     /* void */
     33 }
     34 
     35 /* vsyslog - format one record */
     36 
     37 void
     38 vsyslog(int severity, const char *fmt, va_list ap)
     39 {
     40     char    buf[BUFSIZ];
     41 
     42     vprintf(percent_m(buf, fmt), ap);
     43     printf("\n");
     44     fflush(stdout);
     45 }
     46 
     47 /* syslog - format one record */
     48 
     49 /* VARARGS */
     50 
     51 void
     52 syslog(int severity, const char *fmt, ...)
     53 {
     54     va_list ap;
     55 
     56     va_start(ap, fmt);
     57     vsyslog(severity, fmt, ap);
     58     va_end(ap);
     59 }
     60 
     61 /* closelog - dummy */
     62 
     63 void
     64 closelog()
     65 {
     66     /* void */
     67 }
     68