Revert r326844

There has been some fallout from the change. The change itself was not valueable
enough to spend time investigating the corner cases, let's just back it out.

Reported by:	flo
This commit is contained in:
Baptiste Daroussin 2018-01-02 16:50:57 +00:00
parent 0316d48587
commit 8b081eaa55
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=327494
3 changed files with 10 additions and 13 deletions

View file

@ -5,6 +5,8 @@
.if ${MK_MAILWRAPPER} != "no"
PROG= mailwrapper
MAN= mailwrapper.8
LIBADD= util
.endif
.if ${MK_MAILWRAPPER} != "no" || ${MK_SENDMAIL} != "no"

View file

@ -7,7 +7,8 @@ DIRDEPS = \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt
lib/libcompiler_rt \
lib/libutil \
.include <dirdeps.mk>

View file

@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <libutil.h>
#include <sysexits.h>
#include <syslog.h>
@ -88,17 +89,14 @@ int
main(int argc, char *argv[], char *envp[])
{
FILE *config;
char *line, *cp, *from, *to, *ap, *walk;
char *line, *cp, *from, *to, *ap;
const char *progname;
char localmailerconf[MAXPATHLEN];
const char *mailerconf;
size_t linecap = 0, lineno = 0;
ssize_t linelen;
size_t len, lineno = 0;
int i;
struct arglist al;
line = NULL;
/* change __progname to mailwrapper so we get sensible error messages */
progname = getprogname();
setprogname("mailwrapper");
@ -125,16 +123,12 @@ main(int argc, char *argv[], char *envp[])
}
for (;;) {
if ((linelen = getline(&line, &linecap, config)) <= 0) {
if (feof(config)) {
if ((line = fparseln(config, &len, &lineno, NULL, 0)) == NULL) {
if (feof(config))
errx(EX_CONFIG, "no mapping in %s", mailerconf);
}
err(EX_CONFIG, "cannot parse line %lu", (u_long)lineno);
}
lineno++;
walk = line;
/* strip comments */
strsep(&walk, "#");
#define WS " \t\n"
cp = line;