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