Home | History | Annotate | Line # | Download | only in tcpdchk
fakelog.c revision 1.5
      1  1.5       wiz /*	$NetBSD: fakelog.c,v 1.5 2002/07/06 21:46:59 wiz 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.5       wiz __RCSID("$NetBSD: fakelog.c,v 1.5 2002/07/06 21:46:59 wiz 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.1       cjs vsyslog(severity, fmt, ap)
     42  1.1       cjs int     severity;
     43  1.2  christos const char   *fmt;
     44  1.4    martin _BSD_VA_LIST_ ap;
     45  1.1       cjs {
     46  1.1       cjs     char    buf[BUFSIZ];
     47  1.1       cjs 
     48  1.1       cjs     vprintf(percent_m(buf, fmt), ap);
     49  1.1       cjs     printf("\n");
     50  1.1       cjs     fflush(stdout);
     51  1.1       cjs }
     52  1.1       cjs 
     53  1.1       cjs /* syslog - format one record */
     54  1.1       cjs 
     55  1.1       cjs /* VARARGS */
     56  1.1       cjs 
     57  1.2  christos void
     58  1.2  christos syslog(int severity, const char *fmt, ...)
     59  1.1       cjs {
     60  1.1       cjs     va_list ap;
     61  1.5       wiz 
     62  1.2  christos     va_start(ap, fmt);
     63  1.1       cjs     vsyslog(severity, fmt, ap);
     64  1.2  christos     va_end(ap);
     65  1.1       cjs }
     66  1.1       cjs 
     67  1.1       cjs /* closelog - dummy */
     68  1.1       cjs 
     69  1.2  christos void
     70  1.1       cjs closelog()
     71  1.1       cjs {
     72  1.1       cjs     /* void */
     73  1.1       cjs }
     74