diff options
Diffstat (limited to 'src/qmail-inject.c')
-rw-r--r-- | src/qmail-inject.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/qmail-inject.c b/src/qmail-inject.c index dd8bb21..00a1531 100644 --- a/src/qmail-inject.c +++ b/src/qmail-inject.c @@ -71,6 +71,7 @@ void perm() { _exit(100); } + void temp() { _exit(111); @@ -81,28 +82,33 @@ void die_nomem() buffer_putsflush(buffer_2, "qmail-inject: fatal: out of memory\n"); temp(); } + void die_invalid(stralloc *sa) { buffer_putsflush(buffer_2, "qmail-inject: fatal: invalid header field: "); buffer_putflush(buffer_2, sa->s, sa->len); perm(); } + void die_qqt() { buffer_putsflush(buffer_2, "qmail-inject: fatal: unable to run qmail-queue\n"); temp(); } + void die_chdir() { buffer_putsflush(buffer_2, "qmail-inject: fatal: internal bug\n"); temp(); } + void die_read() { if (errno == ENOMEM) die_nomem(); buffer_putsflush(buffer_2, "qmail-inject: fatal: read error\n"); temp(); } + void doordie(stralloc *sa, int r) { if (r == 1) return; @@ -112,10 +118,10 @@ void doordie(stralloc *sa, int r) perm(); } -GEN_ALLOC_typedef(saa, stralloc, sa, len, a) - GEN_ALLOC_readyplus(saa, stralloc, sa, len, a, i, n, x, 10, saa_readyplus) +GEN_ALLOC_typedef(saa, stralloc, sa, len, a); +GEN_ALLOC_readyplus(saa, stralloc, sa, len, a, i, n, x, 10, saa_readyplus); - static stralloc sauninit = {0}; +static stralloc sauninit = {0}; saa savedh = {0}; saa hrlist = {0}; @@ -714,9 +720,9 @@ int main(int argc, char **argv) starttime = now(); qmopts = env_get("QMAILINJECT"); - if (qmopts) - while (*qmopts) switch (*qmopts++) - { + if (qmopts) { + while (*qmopts) { + switch (*qmopts++) { case 'c': flagnamecomment = 1; break; case 's': flagdeletesender = 1; break; case 'f': flagdeletefrom = 1; break; @@ -724,6 +730,8 @@ int main(int argc, char **argv) case 'r': flaghackrecip = 1; break; case 'm': flaghackmess = 1; break; } + } + } mailhost = env_get("QMAILHOST"); if (!mailhost) mailhost = env_get("MAILHOST"); @@ -752,8 +760,8 @@ int main(int argc, char **argv) if (!saa_readyplus(&hrrlist, 1)) die_nomem(); if (!saa_readyplus(&reciplist, 1)) die_nomem(); - while ((opt = getopt(argc, argv, "aAhHnNf:")) != opteof) switch (opt) - { + while ((opt = getopt(argc, argv, "aAhHnNf:")) != opteof) { + switch (opt) { case 'a': recipstrategy = RECIP_ARGS; break; case 'A': recipstrategy = RECIP_DEFAULT; break; case 'h': recipstrategy = RECIP_HEADER; break; @@ -771,6 +779,7 @@ int main(int argc, char **argv) case '?': default: perm(); } + } argc -= optind; argv += optind; |