pull/75/head
Leah Neukirchen 7 years ago
parent dfe09a7c5e
commit 66d0eff12f

@ -151,7 +151,7 @@ blaze822_addr(char *s, char **dispo, char **addro)
*addr = 0;
while (*s && c < e) {
startover:
startover:
if (*s == '<') {
char *c = addr;
char *e = addr + sizeof addr;

@ -1,7 +1,7 @@
#include <sys/wait.h>
#include <fcntl.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <poll.h>
#include <signal.h>

@ -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:

@ -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");
@ -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;
@ -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);

@ -151,7 +151,7 @@ tryagain:
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) {
@ -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;

@ -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);
}

@ -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");

@ -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;

@ -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;

@ -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);
}

@ -130,7 +130,7 @@ listdir(char *dir)
if (nread == 0)
break;
for (bpos = 0; bpos < nread;) {
for (bpos = 0; bpos < nread; ) {
d = (struct linux_dirent64 *)(buf + bpos);
if (d->d_type != DT_REG && d->d_type != DT_UNKNOWN)
goto next;
@ -224,7 +224,7 @@ main(int argc, char *argv[])
{
int c;
while ((c = getopt(argc, argv, "PRSTDFprstdfX:x:NnCci")) != -1)
switch(c) {
switch (c) {
case 'P': case 'R': case 'S': case 'T': case 'D': case 'F':
flags[(unsigned int)c] = 1;
break;
@ -245,7 +245,7 @@ main(int argc, char *argv[])
case 'c': Cflag = -1; break;
case 'i': iflag = 1; break;
default:
usage:
usage:
fprintf(stderr,
"Usage: mlist [-DFPRST] [-X str]\n"
" [-dfprst] [-x str]\n"

@ -134,7 +134,7 @@ gen_attachment(const char *filename, char *content_disposition)
return;
}
for (s = (char *) filename; *s; s++) {
for (s = (char *)filename; *s; s++) {
if (*s < 32 || *s == '"' || *s >= 127 || s - filename > 35)
goto rfc2231;
if (strchr(" ()<>@,;:\\/[]?=", *s))
@ -161,9 +161,9 @@ rfc2231:
}
while (*s && i < 78 - 3) {
if (*s <= 32 || *s == '"' || *s > 126)
i += printf("%%%02x", (uint8_t) *s++);
i += printf("%%%02x", (uint8_t)*s++);
else
i += printf("%c", (uint8_t) *s++);
i += printf("%c", (uint8_t)*s++);
}
}
@ -291,7 +291,7 @@ print_header(char *line) {
while (*e && *e == ' ')
e++;
for (; *e && *e != ' '; e++) {
if ((uint8_t) *e >= 127)
if ((uint8_t)*e >= 127)
highbit++;
}
@ -470,12 +470,12 @@ main(int argc, char *argv[])
int c;
while ((c = getopt(argc, argv, "crt:")) != -1)
switch(c) {
switch (c) {
case 'r': rflag = 1; break;
case 'c': cflag = 1; break;
case 't': tflag = optarg; break;
default:
usage:
usage:
fprintf(stderr,
"Usage: mmime [-c|-r] [-t CONTENT-TYPE] < message\n");
exit(1);

@ -29,17 +29,17 @@
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <locale.h>
#include <regex.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <strings.h>
#include <time.h>
#include <unistd.h>
#include <wchar.h>
#include <locale.h>
#include <limits.h>
#include <regex.h>
#include "blaze822.h"
@ -163,7 +163,7 @@ static int prune;
static void
ws()
{
while (isspace((unsigned char) *pos))
while (isspace((unsigned char)*pos))
pos++;
}
@ -306,7 +306,7 @@ parse_string(char **s)
char t;
char *e = ++pos;
while (isalnum((unsigned char) *pos) || *pos == '_')
while (isalnum((unsigned char)*pos) || *pos == '_')
pos++;
if (e == pos)
parse_error("invalid environment variable name");
@ -407,12 +407,12 @@ static int64_t
parse_num(int64_t *r)
{
char *s = pos;
if (isdigit((unsigned char) *pos)) {
if (isdigit((unsigned char)*pos)) {
int64_t n;
for (n = 0; isdigit((unsigned char) *pos) && n <= INT64_MAX / 10 - 10; pos++)
for (n = 0; isdigit((unsigned char)*pos) && n <= INT64_MAX / 10 - 10; pos++)
n = 10 * n + (*pos - '0');
if (isdigit((unsigned char) *pos))
if (isdigit((unsigned char)*pos))
parse_error("number too big: %s", s);
if (token("c")) ;
else if (token("b")) n *= 512LL;
@ -499,7 +499,7 @@ parse_cmp()
e->a.prop = prop;
e->b.num = n;
return e;
} else if(token("cur")) {
} else if (token("cur")) {
struct expr *e = mkexpr(op);
e->a.prop = prop;
e->b.var = VAR_CUR;
@ -905,7 +905,7 @@ eval(struct expr *e, struct mailinfo *m)
case EXPR_REGEX:
case EXPR_REGEXI: {
const char *s = "";
switch(e->a.prop) {
switch (e->a.prop) {
case PROP_PATH: s = m->fpath; break;
case PROP_FROM: s = msg_addr(m, "from", e->extra); break;
case PROP_TO: s = msg_addr(m, "to", e->extra); break;
@ -951,7 +951,7 @@ mailfile(char *file)
m->sb = 0;
m->msg = 0;
while (*m->fpath == ' ' || *m->fpath== '\t') {
while (*m->fpath == ' ' || *m->fpath == '\t') {
m->depth++;
m->fpath++;
}
@ -1079,7 +1079,7 @@ collect(char *file)
} else if (thr->cur->m->depth > m->depth) {
/* find parent mail */
struct mlist *pl;
for (pl = thr->cur; pl->m->depth >= m->depth; pl--);
for (pl = thr->cur; pl->m->depth >= m->depth; pl--) ;
ml->parent = pl;
}

@ -8,6 +8,7 @@
#include <errno.h>
#include <fcntl.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -15,7 +16,6 @@
#include <time.h>
#include <unistd.h>
#include <wchar.h>
#include <locale.h>
#include "blaze822.h"
@ -492,7 +492,7 @@ main(int argc, char *argv[])
int c;
while ((c = getopt(argc, argv, "If:n")) != -1)
switch(c) {
switch (c) {
case 'I': Iflag++; break;
case 'f': fflag = optarg; break;
case 'n': nflag = 1; break;

@ -23,8 +23,8 @@ subst(char *str, char *srch, char *repl, char *flags)
int iflag = !!strchr(flags, 'i');
int gflag = !!strchr(flags, 'g');
#define APP(o,l) do {if(bufe-b<(ssize_t)l) return str; memcpy(b,str+i+o,l); b+=l;} while(0)
#define APPC(c) do {if(b>=bufe) return str; *b++=c;} while(0)
#define APP(o, l) do { if (bufe-b < (ssize_t)l) return str; memcpy(b, str+i+o, l); b += l; } while (0)
#define APPC(c) do { if (b >= bufe) return str; *b++ = c; } while (0)
regex_t srchrx;
regmatch_t pmatch[10];
@ -300,7 +300,7 @@ main(int argc, char *argv[])
{
int c;
while ((c = getopt(argc, argv, "")) != -1)
switch(c) {
switch (c) {
default:
fprintf(stderr, "Usage: msed [expr] [msgs...]\n");
exit(1);

@ -2,9 +2,9 @@
#include <errno.h>
#include <limits.h>
#include <search.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "blaze822.h"
@ -151,7 +151,7 @@ fix(FILE *out, char *file)
return 0;
ok:
while(i--)
while (i--)
putc(' ', out);
fprintf(out, "%s\n", bufptr);
return 1;
@ -276,7 +276,7 @@ main(int argc, char *argv[])
{
int c;
while ((c = getopt(argc, argv, "c:frAC:S")) != -1)
switch(c) {
switch (c) {
case 'c': cflag = optarg; break;
case 'f': fflag = 1; break;
case 'r': rflag = 1; break;
@ -284,7 +284,7 @@ main(int argc, char *argv[])
case 'C': Cflag = optarg; break;
case 'S': Sflag = 1; break;
default:
usage:
usage:
fprintf(stderr,
"Usage: mseq [-fr] [-c msg] [msgs...]\n"
" mseq -S [-fr] < sequence\n"

@ -338,7 +338,7 @@ choose_alternative(struct message *msg, int depth)
blaze822_mime_action
reply_mime(int depth, struct message *msg, char *body, size_t bodylen)
{
(void) depth;
(void)depth;
char *ct = blaze822_hdr(msg, "content-type");
char *mt = mimetype(ct);
@ -367,7 +367,7 @@ reply_mime(int depth, struct message *msg, char *body, size_t bodylen)
blaze822_mime_action
list_mime(int depth, struct message *msg, char *body, size_t bodylen)
{
(void) body;
(void)body;
char *ct = blaze822_hdr(msg, "content-type");
if (!ct)
@ -443,7 +443,7 @@ writefile(char *name, char *buf, ssize_t len)
blaze822_mime_action
extract_mime(int depth, struct message *msg, char *body, size_t bodylen)
{
(void) depth;
(void)depth;
char *filename = mime_filename(msg);
@ -576,12 +576,12 @@ print_date_header(char *v)
int p = 3;
int z;
switch(l) {
switch (l) {
case 'y':
z = d / (60*60*24*7*52);
d = d % (60*60*24*7*52);
if (z > 0) {
printf("%d year%s", z, z>1 ? "s" : "");
printf("%d year%s", z, z > 1 ? "s" : "");
if (!--p) break;
printf(", ");
}
@ -590,7 +590,7 @@ print_date_header(char *v)
z = d / (60*60*24*7);
d = d % (60*60*24*7);
if (z > 0) {
printf("%d week%s", z, z>1 ? "s" : "");
printf("%d week%s", z, z > 1 ? "s" : "");
if (!--p) break;
printf(", ");
}
@ -599,7 +599,7 @@ print_date_header(char *v)
z = d / (60*60*24);
d = d % (60*60*24);
if (z > 0) {
printf("%d day%s", z, z>1 ? "s" : "");
printf("%d day%s", z, z > 1 ? "s" : "");
if (!--p) break;
printf(", ");
}
@ -608,7 +608,7 @@ print_date_header(char *v)
z = d / (60*60);
d = d % (60*60);
if (z > 0) {
printf("%d hour%s", z, z>1 ? "s" : "");
printf("%d hour%s", z, z > 1 ? "s" : "");
if (!--p) break;
printf(", ");
}
@ -617,14 +617,14 @@ print_date_header(char *v)
z = d / (60);
d = d % (60);
if (z > 0) {
printf("%d minute%s", z, z>1 ? "s" : "");
printf("%d minute%s", z, z > 1 ? "s" : "");
if (!--p) break;
printf(", ");
}
/* FALL THROUGH */
case 's':
z = d;
printf("%d second%s", z, z>1 ? "s" : "");
printf("%d second%s", z, z > 1 ? "s" : "");
}
if (t < now)
@ -728,7 +728,7 @@ main(int argc, char *argv[])
int c;
while ((c = getopt(argc, argv, "h:A:qrtHLNx:O:Rn")) != -1)
switch(c) {
switch (c) {
case 'h': hflag = optarg; break;
case 'A': Aflag = optarg; break;
case 'q': qflag = 1; break;

@ -1,5 +1,5 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <ctype.h>
#include <stdio.h>
@ -300,7 +300,7 @@ main(int argc, char *argv[])
int c, i;
while ((c = getopt(argc, argv, "fdsFMSUIr")) != -1)
switch(c) {
switch (c) {
case 'f': addorder(fromorder); break;
case 'd': addorder(dateorder); break;
case 's': addorder(subjorder); break;

@ -278,7 +278,7 @@ find_root(const void *nodep, const VISIT which, const int depth)
void
find_roots()
{
top = malloc (sizeof (struct container));
top = malloc(sizeof (struct container));
top->msg = 0;
top->date = -1;
top->file = 0;
@ -401,7 +401,7 @@ main(int argc, char *argv[])
optional = 1;
while ((c = getopt(argc, argv, "S:v")) != -1)
switch(c) {
switch (c) {
case 'S': blaze822_loop1(optarg, thread); break;
case 'v': vflag = 1; break;
default:

@ -1,8 +1,8 @@
#include <sys/types.h>
#include <strings.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "blaze822.h"
#include "blaze822_priv.h"

@ -82,7 +82,7 @@ blaze822_decode_b64(char *s, char *e, char **deco, size_t *decleno)
*deco = buf;
while (s + 4 <= e) {
while (s < e && isfws((unsigned char) *s))
while (s < e && isfws((unsigned char)*s))
s++;
if (s >= e)
break;
@ -90,7 +90,7 @@ blaze822_decode_b64(char *s, char *e, char **deco, size_t *decleno)
uint32_t v = 0;
unsigned char t = 0;
unsigned char c0=s[0], c1=s[1], c2=s[2], c3=s[3];
unsigned char c0 = s[0], c1 = s[1], c2 = s[2], c3 = s[3];
s += 4;
if ((c0 | c1 | c2 | c3) > 127)

@ -1,5 +1,5 @@
#include <stdio.h>
#include <stdint.h>
#include <stdio.h>
void
safe_u8putstr(char *s0, size_t l, FILE *stream)
@ -10,7 +10,7 @@ safe_u8putstr(char *s0, size_t l, FILE *stream)
// - rest is assumed to be latin1, and translated into utf8
// - translate CRLF to CR
unsigned char *s = (unsigned char* )s0;
unsigned char *s = (unsigned char *)s0;
unsigned char *e = s + l;
while (s < e) {

Loading…
Cancel
Save