Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
leahneukirchen committed Aug 31, 2017
1 parent dfe09a7 commit 66d0eff
Show file tree
Hide file tree
Showing 28 changed files with 185 additions and 185 deletions.
12 changes: 6 additions & 6 deletions blaze822.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ blaze822_date(char *s) {

while (iswsp(*s))
s++;
if (i3("jan")) tm.tm_mon = 0;

if (i3("jan")) tm.tm_mon = 0;
else if (i3("feb")) tm.tm_mon = 1;
else if (i3("mar")) tm.tm_mon = 2;
else if (i3("apr")) tm.tm_mon = 3;
Expand All @@ -79,7 +79,7 @@ blaze822_date(char *s) {

while (iswsp(*s))
s++;

if ((c = parse_posint(&s, 1000, 9999)) > 0) {
tm.tm_year = c - 1900;
} else if ((c = parse_posint(&s, 0, 49)) > 0) {
Expand Down Expand Up @@ -143,15 +143,15 @@ blaze822_addr(char *s, char **dispo, char **addro)
if (addro) *addro = 0;
return 0;
}

c = disp;
e = disp + sizeof disp - 1;

*disp = 0;
*addr = 0;

while (*s && c < e) {
startover:
startover:
if (*s == '<') {
char *c = addr;
char *e = addr + sizeof addr;
Expand Down Expand Up @@ -188,7 +188,7 @@ blaze822_addr(char *s, char **dispo, char **addro)
} else if (*s == '(') { // XXX recurse to conform?
s++;

if (!*addr) { // assume: user@host (name)
if (!*addr) { // assume: user@host (name)
*c-- = 0;
while (c > disp && iswsp(*c))
*c-- = 0;
Expand Down
10 changes: 5 additions & 5 deletions filter.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include <sys/wait.h>

#include <fcntl.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <poll.h>
#include <poll.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
Expand All @@ -24,7 +24,7 @@ filter(char *input, size_t inlen, char *cmd, char **outputo, size_t *outleno)
sigemptyset(&mask);
sigaddset(&mask, SIGPIPE);
sigprocmask(SIG_BLOCK, &mask, &orig_mask);

outlen = 0;
output = malloc(outalloc);
if (!output)
Expand Down Expand Up @@ -56,7 +56,7 @@ filter(char *input, size_t inlen, char *cmd, char **outputo, size_t *outleno)
}
close(pipe0[0]);
close(pipe1[1]);

if (pid < 0) {
close(pipe0[1]);
close(pipe1[0]);
Expand Down Expand Up @@ -89,7 +89,7 @@ filter(char *input, size_t inlen, char *cmd, char **outputo, size_t *outleno)
} else if (fds[0].revents & (POLLERR | POLLHUP | POLLNVAL)) {
fds[0].fd = -1;
}

if (fds[1].revents & POLLOUT) {
ssize_t ret = write(fds[1].fd, input, inlen);
if (ret > 0) {
Expand Down
6 changes: 3 additions & 3 deletions maddr.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ addr(char *file)
{
while (*file == ' ' || *file == '\t')
file++;

struct message *msg = blaze822(file);
if (!msg)
return;
Expand All @@ -36,7 +36,7 @@ addr(char *file)
blaze822_decode_rfc2047(vdec, v, sizeof vdec - 1, "UTF-8");
vdec[sizeof vdec - 1] = 0;
v = vdec;

while ((v = blaze822_addr(v, &disp, &addr))) {
if (disp && addr && strcmp(disp, addr) == 0)
disp = 0;
Expand Down Expand Up @@ -64,7 +64,7 @@ main(int argc, char *argv[])
{
int c;
while ((c = getopt(argc, argv, "ah:")) != -1)
switch(c) {
switch (c) {
case 'a': aflag = 1; break;
case 'h': hflag = optarg; break;
default:
Expand Down
8 changes: 4 additions & 4 deletions magrep.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ match(char *file, char *hdr, char *s)
blaze822_mime_action
match_part(int depth, struct message *msg, char *body, size_t bodylen)
{
(void) depth;
(void)depth;

char *ct = blaze822_hdr(msg, "content-type");

Expand Down Expand Up @@ -163,7 +163,7 @@ main(int argc, char *argv[])
{
int c;
while ((c = getopt(argc, argv, "acdim:opqv")) != -1)
switch(c) {
switch (c) {
case 'a': aflag = 1; break;
case 'c': cflag = 1; break;
case 'd': dflag = 1; break;
Expand All @@ -174,7 +174,7 @@ main(int argc, char *argv[])
case 'q': qflag = 1; break;
case 'v': vflag = 1; break;
default:
usage:
usage:
fprintf(stderr,
"Usage: magrep [-c|-o|-p|-q|-m max] [-v] [-i] [-a|-d] header:regex [msgs...]\n");
exit(2);
Expand All @@ -201,7 +201,7 @@ main(int argc, char *argv[])
blaze822_loop1(":", magrep);
else
blaze822_loop(argc-optind, argv+optind, magrep);

if (cflag && !qflag && !mflag)
printf("%ld\n", matches);

Expand Down
14 changes: 7 additions & 7 deletions mdeliver.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ deliver(FILE *infile)
snprintf(id, sizeof id, "%ld.M%06ldP%ldQ%ld.%s",
(long)tv.tv_sec, (long)tv.tv_usec, (long)getpid(),
delivery, host);

snprintf(tmp, sizeof tmp, "%s/tmp/%s", targetdir, id);

outfd = open(tmp, O_CREAT | O_WRONLY | O_EXCL, 0666);
if (outfd < 0) {
if (errno == EEXIST)
Expand Down Expand Up @@ -151,14 +151,14 @@ deliver(FILE *infile)
int i, j;
for (i = sizeof statusflags - 1; i >= 0; i--)
if (!statusflags[i])
for (j = i+1; j < (int) sizeof statusflags; j++)
for (j = i+1; j < (int)sizeof statusflags; j++)
statusflags[j-1] = statusflags[j];

if (Mflag) {
struct message *msg = blaze822_file(tmp);
time_t date = -1;
char *v;

if (msg && (v = blaze822_hdr(msg, "date"))) {
date = blaze822_date(v);
if (date != -1) {
Expand All @@ -172,8 +172,8 @@ deliver(FILE *infile)
}

snprintf(dst, sizeof dst, "%s/%s/%s:2,%s",
targetdir, (cflag || is_old) ? "cur" : "new", id,
Xflag ? Xflag : statusflags);
targetdir, (cflag || is_old) ? "cur" : "new", id,
Xflag ? Xflag : statusflags);
if (rename(tmp, dst) != 0)
return -1;

Expand All @@ -188,7 +188,7 @@ main(int argc, char *argv[])
{
int c;
while ((c = getopt(argc, argv, "cMvX:")) != -1)
switch(c) {
switch (c) {
case 'c': cflag = 1; break;
case 'M': Mflag = 1; break;
case 'v': vflag = 1; break;
Expand Down
8 changes: 4 additions & 4 deletions mdirs.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ mdirs(char *fpath)

if (dotonly && d->d_name[0] != '.')
continue;

mdirs(d->d_name);
}

if (chdir("..") < 0)
exit(-1);

Expand All @@ -71,9 +71,9 @@ main(int argc, char *argv[])
{
int c, i;
while ((c = getopt(argc, argv, "")) != -1)
switch(c) {
switch (c) {
default:
usage:
usage:
fprintf(stderr, "Usage: mdirs dirs...\n");
exit(1);
}
Expand Down
18 changes: 9 additions & 9 deletions mexport.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export(char *file)
if (e) {
s++;
snprintf(from, sizeof from, "%.*s",
(int)(e-s), s);
(int)(e-s), s);
}
} else { // return-path without <>
snprintf(from, sizeof from, "%s", v);
Expand All @@ -66,7 +66,7 @@ export(char *file)

char *line = 0;
size_t linelen = 0;

printf("From %s %s", from, ctime(&date));

int in_header = 1;
Expand All @@ -83,7 +83,7 @@ export(char *file)
status = 1;
return;
}

if (in_header && line[0] == '\n' && !line[1]) {
if (Sflag) {
char *flags = strstr(file, ":2,");
Expand All @@ -94,21 +94,21 @@ export(char *file)
if (strchr(flags, 'S'))
putchar('R');
char *ee = strrchr(file, '/');
if (!ee ||
if (!ee ||
!(ee >= file + 3 && ee[-3] == 'n' && ee[-2] == 'e' && ee[-1] == 'w'))
putchar('O');
putchar('\n');

fputs("X-Status: ", stdout);
if (strchr(flags, 'R')) putchar('A');
if (strchr(flags, 'T')) putchar('D');
if (strchr(flags, 'F')) putchar('F');
putchar('\n');
}

in_header = 0;
}

// MBOXRD: add first > to >>..>>From
char *s = line;
while (*s == '>')
Expand All @@ -132,7 +132,7 @@ main(int argc, char *argv[])
{
int c;
while ((c = getopt(argc, argv, "S")) != -1)
switch(c) {
switch (c) {
case 'S': Sflag = 1; break;
default:
fprintf(stderr, "Usage: mexport [-S] [msgs...]\n");
Expand All @@ -145,6 +145,6 @@ main(int argc, char *argv[])
blaze822_loop1(":", export);
else
blaze822_loop(argc-optind, argv+optind, export);

return status;
}
6 changes: 3 additions & 3 deletions mflag.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ flag(char *file)

return;
}

skip:
if (vflag)
printf("%s\n", file);
Expand All @@ -110,7 +110,7 @@ main(int argc, char *argv[])
{
int c;
while ((c = getopt(argc, argv, "PRSTDFprstdfX:x:v")) != -1)
switch(c) {
switch (c) {
case 'P': case 'R': case 'S': case 'T': case 'D': case 'F':
flags[(unsigned int)c] = 1;
break;
Expand Down Expand Up @@ -151,7 +151,7 @@ main(int argc, char *argv[])
blaze822_loop1(":", flag);
else
blaze822_loop(0, 0, flag);

return 0;
}

Expand Down
6 changes: 3 additions & 3 deletions mflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ main()
}

if (rd > 0 && line[rd-1] == '\n')
line[--rd] = 0;
line[--rd] = 0;
if (rd > 0 && line[rd-1] == '\r')
line[--rd] = 0;
line[--rd] = 0;

quotes = 0;
while (*line == '>') { // measure quote depth
line++;
Expand Down
6 changes: 3 additions & 3 deletions mgenmid.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ int main()
hostbuf[sizeof hostbuf - 1] = 0;

struct addrinfo hints = { .ai_family = AF_UNSPEC,
.ai_socktype = SOCK_STREAM,
.ai_flags = AI_CANONNAME };
.ai_socktype = SOCK_STREAM,
.ai_flags = AI_CANONNAME };
struct addrinfo *info;
if (getaddrinfo(hostbuf, 0, &hints, &info) == 0) {
// sanity checks: no (null), at least one dot,
Expand Down Expand Up @@ -81,7 +81,7 @@ int main()
" or add a FQDN to /etc/hosts.\n");
exit(1);
}

struct timeval tp;
gettimeofday(&tp, (struct timezone *)0);

Expand Down
6 changes: 3 additions & 3 deletions mhdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ print_addresses(char *s)
printf("%s\t", curfile);

if (disp && addr)
printf("%s <%s>\n", disp, addr);
printf("%s <%s>\n", disp, addr);
else if (addr)
printf("%s\n", addr);
}
Expand Down Expand Up @@ -189,7 +189,7 @@ main(int argc, char *argv[])
{
int c;
while ((c = getopt(argc, argv, "h:ADHMd")) != -1)
switch(c) {
switch (c) {
case 'h': hflag = optarg; break;
case 'A': Aflag = 1; break;
case 'D': Dflag = 1; break;
Expand All @@ -208,6 +208,6 @@ main(int argc, char *argv[])
blaze822_loop1(".", header);
else
blaze822_loop(argc-optind, argv+optind, header);

return status;
}
4 changes: 2 additions & 2 deletions minc.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ main(int argc, char *argv[])
{
int c, i;
while ((c = getopt(argc, argv, "q")) != -1)
switch(c) {
switch (c) {
case 'q': qflag = 1; break;
default:
usage:
usage:
fprintf(stderr, "Usage: minc [-q] dirs...\n");
exit(1);
}
Expand Down
Loading

0 comments on commit 66d0eff

Please sign in to comment.