Annotation of 40BSD/cmd/delivermail/err.c, revision 1.1.1.1

1.1       root        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   1.5     10/21/80";
                      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:        Errors++;
                     48: 
                     49:        /* determine exit status if not already set */
                     50:        if (ExitStat == EX_OK)
                     51:        {
                     52:                if (errno == 0)
                     53:                        ExitStat = EX_SOFTWARE;
                     54:                else
                     55:                        ExitStat = EX_OSERR;
                     56:        }
                     57: 
                     58: # ifdef LOG
                     59:        logmsg(LOG_ERR, "%s->%s: %s", From.q_paddr, To, errbuf);
                     60: # endif LOG
                     61:        errno = 0;
                     62:        return (-1);
                     63: }
                     64: /*
                     65: **  USRERR -- Signal user error.
                     66: **
                     67: **     This is much like syserr except it is for user errors.
                     68: **
                     69: **     Parameters:
                     70: **             fmt, a, b, c, d -- printf strings
                     71: **
                     72: **     Returns:
                     73: **             -1
                     74: **
                     75: **     Side Effects:
                     76: **             increments Errors.
                     77: */
                     78: 
                     79: /*VARARGS1*/
                     80: usrerr(fmt, a, b, c, d, e)
                     81:        char *fmt;
                     82: {
                     83:        extern char SuprErrs;
                     84: 
                     85:        if (SuprErrs)
                     86:                return;
                     87: 
                     88:        Errors++;
                     89:        if (To != NULL)
                     90:                printf("%s... ", To);
                     91:        printf(fmt, a, b, c, d, e);
                     92:        printf("\n");
                     93:        return (-1);
                     94: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.