diff options
author | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-03 15:52:39 +0200 |
---|---|---|
committer | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-03 15:52:39 +0200 |
commit | a6a7d6ce079cabdaf2fa502b2e2cf15e5428ac6f (patch) | |
tree | b88cc7a8457658d67e0321718556ac807f6bccf3 /src/printmaillist.c | |
parent | 00be7622c428f279872f84569f098ce16150f8a8 (diff) |
format files
Diffstat (limited to 'src/printmaillist.c')
-rw-r--r-- | src/printmaillist.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/src/printmaillist.c b/src/printmaillist.c index 6edb3b3..8de8b69 100644 --- a/src/printmaillist.c +++ b/src/printmaillist.c @@ -1,15 +1,16 @@ #include <unistd.h> + #include "buffer.h" -#include "logmsg.h" -#include "stralloc.h" #include "getln.h" +#include "logmsg.h" #include "str.h" +#include "stralloc.h" #define WHO "printmaillist" void badformat() { - logmsg(WHO,100,FATAL,"bad mailing list format"); + logmsg(WHO, 100, FATAL, "bad mailing list format"); } stralloc line = {0}; @@ -18,33 +19,27 @@ int match; int main() { for (;;) { - if (getln(buffer_1small,&line,&match,'\0') == -1) - logmsg(WHO,111,FATAL,"unable to read input: "); + if (getln(buffer_1small, &line, &match, '\0') == -1) + logmsg(WHO, 111, FATAL, "unable to read input: "); if (!match) { - if (line.len) - badformat(); - if (buffer_flush(buffer_1small) == -1) - logmsg(WHO,111,FATAL,"unable to write output: "); + if (line.len) badformat(); + if (buffer_flush(buffer_1small) == -1) logmsg(WHO, 111, FATAL, "unable to write output: "); _exit(0); } - if (line.s[str_chr(line.s,'\n')]) badformat(); + if (line.s[str_chr(line.s, '\n')]) badformat(); if (line.s[line.len - 1] == ' ') badformat(); if (line.s[line.len - 1] == '\t') badformat(); if ((line.s[0] == '.') || (line.s[0] == '/')) { - if (buffer_puts(buffer_1small,line.s) == -1) - logmsg(WHO,111,FATAL,"unable to write output: "); - if (buffer_puts(buffer_1small,"\n") == -1) - logmsg(WHO,111,FATAL,"unable to write output: "); + if (buffer_puts(buffer_1small, line.s) == -1) logmsg(WHO, 111, FATAL, "unable to write output: "); + if (buffer_puts(buffer_1small, "\n") == -1) logmsg(WHO, 111, FATAL, "unable to write output: "); continue; } if (line.s[0] == '&') { if (line.len > 900) badformat(); - if (buffer_puts(buffer_1small,line.s) == -1) - logmsg(WHO,111,FATAL,"unable to write output: "); - if (buffer_puts(buffer_1small,"\n") == -1) - logmsg(WHO,111,FATAL,"unable to write output: "); + if (buffer_puts(buffer_1small, line.s) == -1) logmsg(WHO, 111, FATAL, "unable to write output: "); + if (buffer_puts(buffer_1small, "\n") == -1) logmsg(WHO, 111, FATAL, "unable to write output: "); continue; } |