# 2.11BSD#431 - /usr/src/libexec/tcpd/diag.c

##### Functions

    VARARGS           X

##### Variables

    tcpd_buf          X
    tcpd_context      X

       1:  /*
       2:   * Routines to report various classes of problems. Each report is decorated
       3:   * with the current context (file name and line number), if available.
       4:   *
       5:   * tcpd_warn() reports a problem and proceeds.
       6:   *
       7:   * tcpd_jump() reports a problem and jumps.
       8:   *
       9:   * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
      10:   */
      11:
      12: #ifndef lint
      13: static char sccsid[] = "@(#) diag.c 1.1 94/12/28 17:42:20";
      14: #endif
      15:
      16: /* System libraries */
      17:
      18: #include <syslog.h>
      19: #include <stdio.h>
      20: #include <setjmp.h>
      21:
      22: /* Local stuff */
      23:
      24: #include "tcpd.h"
      25: #include "mystdarg.h"
      26:
      27: struct tcpd_context tcpd_context;
      28: jmp_buf tcpd_buf;
      29:
      30: /* tcpd_diag - centralize error reporter */
      31:
      32: static void tcpd_diag(severity, tag, format, ap)
      33: int     severity;
      34: char   *tag;
      35: char   *format;
      36: va_list ap;
      37: {
      38:     char    fmt[BUFSIZ];
      39:
      40:     if (tcpd_context.file)
      41:     sprintf(fmt, "%s: %s, line %d: %s",
      42:         tag, tcpd_context.file, tcpd_context.line, format);
      43:     else
      44:     sprintf(fmt, "%s: %s", tag, format);
      45:     vsyslog(severity, fmt, ap);
      46: }
      47:
      48: /* tcpd_warn - report problem of some sort and proceed */
      49:
      50: void    VARARGS(tcpd_warn, char *, format)
      51: {
      52:     va_list ap;
      53:
      54:     VASTART(ap, char *, format);
      55:     tcpd_diag(LOG_ERR, "warning", format, ap);
      56:     VAEND(ap);
      57: }
      58:
      59: /* tcpd_jump - report serious problem and jump */
      60:
      61: void    VARARGS(tcpd_jump, char *, format)
      62: {
      63:     va_list ap;
      64:
      65:     VASTART(ap, char *, format);
      66:     tcpd_diag(LOG_ERR, "error", format, ap);
      67:     VAEND(ap);
      68:     longjmp(tcpd_buf, AC_ERROR);
      69: }

#### Defined functions

VARARGS defined in line 61; never used
tcpd_diag defined in line 32; used 2 times

- in line 55, 66

#### Defined variables

sccsid defined in line 13; never used
tcpd_buf defined in line 28; used 5 times

- in line 68
- in /usr/src/libexec/tcpd/hosts_access.c line 106
- in /usr/src/libexec/tcpd/options.c line 200, 211
- in /usr/src/libexec/tcpd/tcpdchk.c line 225

tcpd_context defined in line 27; used 9 times

- in line 40-42(3)
- in /usr/src/libexec/tcpd/tcpdchk.c line 192-196(3), 212(2), 249

Last modified: 1994-12-28 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 667 |