summaryrefslogtreecommitdiff
path: root/src/fastforward.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-03 19:03:11 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-03 19:03:11 +0200
commit20b85c03e751b4876fa3c92040464e483172b746 (patch)
tree734fadbfdbc143ec4465093857f4c239448715e0 /src/fastforward.c
parenta6a7d6ce079cabdaf2fa502b2e2cf15e5428ac6f (diff)
manual format adjustment
Diffstat (limited to 'src/fastforward.c')
-rw-r--r--src/fastforward.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/fastforward.c b/src/fastforward.c
index a702d41..731ada8 100644
--- a/src/fastforward.c
+++ b/src/fastforward.c
@@ -95,7 +95,7 @@ void dofile(char *fn)
if (readclose_append(fd, &mailinglist, 1024) == -1) logmsg(WHO, 111, FATAL, B("unable to read: ", fn));
i = 0;
- for (j = 0; j < mailinglist.len; ++j)
+ for (j = 0; j < mailinglist.len; ++j) {
if (!mailinglist.s[j]) {
if ((mailinglist.s[i] == '.') || (mailinglist.s[i] == '/')) {
if (!stralloc_cats(&todo, mailinglist.s + i)) nomem();
@@ -106,6 +106,7 @@ void dofile(char *fn)
}
i = j + 1;
}
+ }
}
char *fncdb;
@@ -227,11 +228,11 @@ void dodata()
int j;
i = 0;
- for (j = 0; j < data.len; ++j)
+ for (j = 0; j < data.len; ++j) {
if (!data.s[j]) {
- if ((data.s[i] == '|') || (data.s[i] == '!'))
+ if ((data.s[i] == '|') || (data.s[i] == '!')) {
doprogram(data.s + i);
- else if ((data.s[i] == '.') || (data.s[i] == '/')) {
+ } else if ((data.s[i] == '.') || (data.s[i] == '/')) {
if (!stralloc_cats(&todo, data.s + i)) nomem();
if (!stralloc_0(&todo)) nomem();
} else if ((data.s[i] == '&') && (j - i < 900)) {
@@ -240,16 +241,18 @@ void dodata()
}
i = j + 1;
}
+ }
}
void dorecip(char *addr)
{
- if (!findtarget(0, "?", addr))
+ if (!findtarget(0, "?", addr)) {
if (gettarget(0, ":", addr)) {
dodata();
return;
}
+ }
if (!stralloc_cats(&forward, addr)) nomem();
if (!stralloc_0(&forward)) nomem();
}
@@ -260,11 +263,12 @@ void doorigrecip(char *addr)
if ((sender.len != 4) || byte_diff(sender.s, 4, "#@[]"))
if (gettarget(1, "?", addr))
if (!stralloc_copy(&sender, &data)) nomem();
- if (!gettarget(1, ":", addr))
+ if (!gettarget(1, ":", addr)) {
if (flagpassthrough)
_exit(0);
else
logmsg(WHO, 100, ERROR, "Sorry, no mailbox here by that name. (#5.1.1)");
+ }
dodata();
}
@@ -289,8 +293,8 @@ int main(int argc, char **argv)
if (!stralloc_copys(&forward, "")) nomem();
if (!strset_init(&done)) nomem();
- while ((opt = getopt(argc, argv, "nNpPdD")) != opteof) switch (opt)
- {
+ while ((opt = getopt(argc, argv, "nNpPdD")) != opteof) {
+ switch (opt) {
case 'n': flagdeliver = 0; break;
case 'N': flagdeliver = 1; break;
case 'p': flagpassthrough = 1; break;
@@ -299,6 +303,7 @@ int main(int argc, char **argv)
case 'D': flagdefault = 0; break;
default: usage();
}
+ }
argv += optind;
fncdb = *argv;