Changeset View
Changeset View
Standalone View
Standalone View
head/usr.sbin/mailwrapper/mailwrapper.c
Show All 34 Lines | |||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <err.h> | #include <err.h> | ||||
#include <paths.h> | |||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <libutil.h> | #include <libutil.h> | ||||
#include <sysexits.h> | #include <sysexits.h> | ||||
#include <syslog.h> | #include <syslog.h> | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | main(int argc, char *argv[], char *envp[]) | ||||
/* change __progname to mailwrapper so we get sensible error messages */ | /* change __progname to mailwrapper so we get sensible error messages */ | ||||
progname = getprogname(); | progname = getprogname(); | ||||
setprogname("mailwrapper"); | setprogname("mailwrapper"); | ||||
initarg(&al); | initarg(&al); | ||||
addarg(&al, argv[0]); | addarg(&al, argv[0]); | ||||
snprintf(localmailerconf, MAXPATHLEN, "%s/etc/mail/mailer.conf", | snprintf(localmailerconf, MAXPATHLEN, "%s/etc/mail/mailer.conf", | ||||
getenv("LOCALBASE") ? getenv("LOCALBASE") : "/usr/local"); | getenv("LOCALBASE") ? getenv("LOCALBASE") : _PATH_LOCALBASE); | ||||
mailerconf = localmailerconf; | mailerconf = localmailerconf; | ||||
if ((config = fopen(localmailerconf, "r")) == NULL) | if ((config = fopen(localmailerconf, "r")) == NULL) | ||||
mailerconf = _PATH_MAILERCONF; | mailerconf = _PATH_MAILERCONF; | ||||
if (config == NULL && ((config = fopen(mailerconf, "r")) == NULL)) { | if (config == NULL && ((config = fopen(mailerconf, "r")) == NULL)) { | ||||
addarg(&al, NULL); | addarg(&al, NULL); | ||||
openlog(getprogname(), LOG_PID, LOG_MAIL); | openlog(getprogname(), LOG_PID, LOG_MAIL); | ||||
▲ Show 20 Lines • Show All 59 Lines • Show Last 20 Lines |