static char SccsId
[] = "@(#)err.c 3.16 %G%";
** SYSERR -- Print error message.
** Prints an error message via printf to the diagnostic
** output. If LOG is defined, it logs it also.
** f -- the format string
** a, b, c, d, e -- parameters
syserr(fmt
, a
, b
, c
, d
, e
)
static char errbuf
[MAXLINE
+1];
extern char Arpa_Syserr
[];
/* format the error message */
fmtmsg(errbuf
, (char *) NULL
, Arpa_Syserr
, fmt
, a
, b
, c
, d
, e
);
/* output error message to transcript */
fprintf(Xscript
, "%s\n", errbuf
);
/* output error message to output channel if appropriate */
fprintf(OutChannel
, "%s\r\n", errbuf
);
fprintf(OutChannel
, "sendmail: %s\n", &errbuf
[4]);
(void) fflush(OutChannel
);
/* determine exit status if not already set */
syslog(LOG_ERR
, "%s->%s: %s", From
.q_paddr
, To
, &errbuf
[4]);
** USRERR -- Signal user error.
** This is much like syserr except it is for user errors.
** fmt, a, b, c, d -- printf strings
usrerr(fmt
, a
, b
, c
, d
, e
)
extern char Arpa_Usrerr
[];
message(Arpa_Usrerr
, fmt
, a
, b
, c
, d
, e
);
** MESSAGE -- print message (not necessarily an error)
** num -- the default ARPANET error number (in ascii)
** msg -- the message (printf fmt) -- if it begins
** with a digit, this number overrides num.
** a, b, c, d, e -- printf arguments
message(num
, msg
, a
, b
, c
, d
, e
)
fmtmsg(errbuf
, To
, num
, msg
, a
, b
, c
, d
, e
);
/* output to transcript */
fprintf(Xscript
, "%s\n", errbuf
);
/* output to channel if appropriate */
fprintf(OutChannel
, "%s\r\n", errbuf
);
fprintf(OutChannel
, "%s\n", &errbuf
[4]);
(void) fflush(OutChannel
);
** FMTMSG -- format a message into buffer.
** eb -- error buffer to get result.
** to -- the recipient tag for this message.
** num -- arpanet error number.
** fmt -- format of string.
** a, b, c, d, e -- arguments.
fmtmsg(eb
, to
, num
, fmt
, a
, b
, c
, d
, e
)
/* output the reply code */
(void) sprintf(eb
, "%3.3s%c", num
, del
);
/* output the "to" person */
if (to
!= NULL
&& to
[0] != '\0')
(void) sprintf(eb
, "%s... ", to
);
(void) sprintf(eb
, fmt
, a
, b
, c
, d
, e
);
/* output the error code, if any */
extern char *sys_errlist
[];
if (errno
< sys_nerr
&& errno
> 0)
(void) sprintf(eb
, ": %s", sys_errlist
[errno
]);
(void) sprintf(eb
, ": error %d", errno
);