1: # include <stdio.h>
   2: # include "dlvrmail.h"
   3: # ifdef LOG
   4: # include <log.h>
   5: # endif LOG
   6: 
   7: static char SccsId[] = "@(#)err.c	2.2	1/10/81";
   8: 
   9: /*
  10: **  SYSERR -- Print error message.
  11: **
  12: **	Prints an error message via printf to the diagnostic
  13: **	output.  If LOG is defined, it logs it also.
  14: **
  15: **	Parameters:
  16: **		f -- the format string
  17: **		a, b, c, d, e -- parameters
  18: **
  19: **	Returns:
  20: **		-1 always
  21: **
  22: **	Side Effects:
  23: **		increments Errors.
  24: **		sets ExitStat.
  25: */
  26: 
  27: /*VARARGS1*/
  28: syserr(fmt, a, b, c, d, e)
  29:     char *fmt;
  30: {
  31:     extern int errno;
  32:     static char errbuf[MAXLINE+1];
  33:     register char *p;
  34:     extern char *sys_errlist[];
  35:     extern int sys_nerr;
  36: 
  37:     sprintf(errbuf, fmt, a, b, c, d, e);
  38:     if (errno != 0)
  39:     {
  40:         p = &errbuf[strlen(errbuf)];
  41:         if (errno < sys_nerr && errno > 0)
  42:             sprintf(p, ": %s", sys_errlist[errno]);
  43:         else
  44:             sprintf(p, ": error %d", errno);
  45:     }
  46:     printf("delivermail: %s\n", errbuf);
  47:     fflush(stdout);
  48:     Errors++;
  49: 
  50:     /* determine exit status if not already set */
  51:     if (ExitStat == EX_OK)
  52:     {
  53:         if (errno == 0)
  54:             ExitStat = EX_SOFTWARE;
  55:         else
  56:             ExitStat = EX_OSERR;
  57:     }
  58: 
  59: # ifdef LOG
  60:     logmsg(LOG_ERR, "%s->%s: %s", From.q_paddr, To, errbuf);
  61: # endif LOG
  62:     errno = 0;
  63:     return (-1);
  64: }
  65: /*
  66: **  USRERR -- Signal user error.
  67: **
  68: **	This is much like syserr except it is for user errors.
  69: **
  70: **	Parameters:
  71: **		fmt, a, b, c, d -- printf strings
  72: **
  73: **	Returns:
  74: **		-1
  75: **
  76: **	Side Effects:
  77: **		increments Errors.
  78: */
  79: 
  80: /*VARARGS1*/
  81: usrerr(fmt, a, b, c, d, e)
  82:     char *fmt;
  83: {
  84:     extern char SuprErrs;
  85: 
  86:     if (SuprErrs)
  87:         return;
  88: 
  89:     Errors++;
  90:     if (To != NULL)
  91:         printf("%s... ", To);
  92:     printf(fmt, a, b, c, d, e);
  93:     printf("\n");
  94:     fflush(stdout);
  95:     return (-1);
  96: }

Defined functions

syserr defined in line 28; never used
usrerr defined in line 81; never used

Defined variables

SccsId defined in line 7; never used
Last modified: 1981-02-06
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 754
Valid CSS Valid XHTML 1.0 Strict