This commit is contained in:
Alex Holst 2017-09-18 13:10:20 +02:00
commit 888ed08855
45 changed files with 341 additions and 255 deletions

View File

@ -1,11 +1,13 @@
CFLAGS+=-g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 CFLAGS=-g -O2
override CFLAGS:=-Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 $(CFLAGS)
LDLIBS=-lrt LDLIBS=-lrt
OS := $(shell uname) OS := $(shell uname)
ifeq ($(OS),OpenBSD) ifeq ($(OS),OpenBSD)
CFLAGS+=-I/usr/local/include -pthread LOCALBASE=/usr/local
LDLIBS=-L/usr/local/lib -liconv -pthread CFLAGS+=-I$(LOCALBASE)/include -pthread
LDLIBS=-L$(LOCALBASE)/lib -liconv -pthread
endif endif
ifeq ($(OS),Darwin) ifeq ($(OS),Darwin)
@ -28,7 +30,7 @@ maddr magrep mdeliver mexport mflag mflow mgenmid mhdr mpick mscan msed mshow \
maddr magrep mexport mflag mgenmid mhdr mlist mpick mscan msed mseq mshow msort \ maddr magrep mexport mflag mgenmid mhdr mlist mpick mscan msed mseq mshow msort \
mthread : seq.o slurp.o mthread : seq.o slurp.o
maddr magrep mflow mhdr mpick mscan mshow : rfc2047.o maddr magrep mflow mhdr mpick mscan mshow : rfc2047.o
magrep mflow mshow : rfc2045.o magrep mflow mhdr mshow : rfc2045.o
mshow : filter.o safe_u8putstr.o rfc2231.o pipeto.o mshow : filter.o safe_u8putstr.o rfc2231.o pipeto.o
mscan : pipeto.o mscan : pipeto.o
msort : mystrverscmp.o msort : mystrverscmp.o

View File

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

8
contrib/mrecode Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
# mrecode - recode stdin respecting PIPE_CHARSET into UTF-8
if [ -n "$PIPE_CHARSET" ]; then
exec iconv -f "$PIPE_CHARSET" -t UTF-8
else
exec cat
fi

View File

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

View File

@ -65,7 +65,7 @@ main(int argc, char *argv[])
{ {
int c; int c;
while ((c = getopt(argc, argv, "ah:")) != -1) while ((c = getopt(argc, argv, "ah:")) != -1)
switch(c) { switch (c) {
case 'a': aflag = 1; break; case 'a': aflag = 1; break;
case 'h': hflag = optarg; break; case 'h': hflag = optarg; break;
default: default:

View File

@ -68,7 +68,7 @@ match(char *file, char *hdr, char *s)
blaze822_mime_action blaze822_mime_action
match_part(int depth, struct message *msg, char *body, size_t bodylen) match_part(int depth, struct message *msg, char *body, size_t bodylen)
{ {
(void) depth; (void)depth;
char *ct = blaze822_hdr(msg, "content-type"); char *ct = blaze822_hdr(msg, "content-type");
@ -164,7 +164,7 @@ main(int argc, char *argv[])
{ {
int c; int c;
while ((c = getopt(argc, argv, "acdim:opqv")) != -1) while ((c = getopt(argc, argv, "acdim:opqv")) != -1)
switch(c) { switch (c) {
case 'a': aflag = 1; break; case 'a': aflag = 1; break;
case 'c': cflag = 1; break; case 'c': cflag = 1; break;
case 'd': dflag = 1; break; case 'd': dflag = 1; break;
@ -175,7 +175,7 @@ main(int argc, char *argv[])
case 'q': qflag = 1; break; case 'q': qflag = 1; break;
case 'v': vflag = 1; break; case 'v': vflag = 1; break;
default: default:
usage: usage:
fprintf(stderr, fprintf(stderr,
"Usage: magrep [-c|-o|-p|-q|-m max] [-v] [-i] [-a|-d] header:regex [msgs...]\n"); "Usage: magrep [-c|-o|-p|-q|-m max] [-v] [-i] [-a|-d] header:regex [msgs...]\n");
exit(2); exit(2);

View File

@ -40,9 +40,9 @@ Only search the colon-separated list of
.Ar headers .Ar headers
for mail addresses. for mail addresses.
Default: Default:
.Sq Li "from:sender:reply-to:to:cc:bcc:" .Sq Li from\&:sender\&:reply\&-to\&:to\&:cc\&:bcc\&:
and their respective and their respective
.Sq Li "resent-" .Sq Li resent\&-
variants. variants.
.El .El
.Sh EXIT STATUS .Sh EXIT STATUS

View File

@ -32,40 +32,40 @@ The following
are used by are used by
.Xr mblaze 7 : .Xr mblaze 7 :
.Bl -tag -width Ds .Bl -tag -width Ds
.It Li "Alternate-Mailboxes:" .It Li Alternate\&-Mailboxes\&:
A comma-separated list of mail addresses that belong to you, for A comma-separated list of mail addresses that belong to you, for
.Xr mscan 1 .Xr mscan 1
to recognize messages sent by or directly to you. to recognize messages sent by or directly to you.
.It Li "FQDN:" .It Li FQDN\&:
The fully qualified domain name used for The fully qualified domain name used for
.Li "Message-Id:" .Li Message\&-Id\&:
generation in generation in
.Xr mgenmid 1 . .Xr mgenmid 1 .
.It Li "Local-Mailbox:" .It Li Local\&-Mailbox\&:
Your primary mail address, used as the default value for Your primary mail address, used as the default value for
.Li "From:" .Li From\&:
in in
.Xr mcom 1 , .Xr mcom 1 ,
and in and in
.Xr mscan 1 .Xr mscan 1
to recognize messages sent to you. to recognize messages sent to you.
.It Li "Outbox:" .It Li Outbox\&:
If set, If set,
.Xr mcom 1 .Xr mcom 1
will create draft messages in this Maildir, will create draft messages in this Maildir,
and save messages there after sending. and save messages there after sending.
.It Li "Scan-Format:" .It Li Scan\&-Format\&:
The default format string for The default format string for
.Xr mscan 1 . .Xr mscan 1 .
.It Li "Sendmail:" .It Li Sendmail\&:
The program that The program that
.Xr mcom 1 .Xr mcom 1
will call to send mail. will call to send mail.
(Default: (Default:
.Sq Li sendmail ) . .Sq Li sendmail ) .
.It Li "Sendmail-Args:" .It Li Sendmail\&-Args\&:
Flags to be passed to the Flags to be passed to the
.Li "Sendmail:" .Li Sendmail\&:
program. program.
(Default: (Default:
.Sq Fl t ) . .Sq Fl t ) .

View File

@ -37,11 +37,11 @@ and deliver each message,
decoding it according to the MBOXRD convention. decoding it according to the MBOXRD convention.
.Nm .Nm
will set the mtime according to the value of will set the mtime according to the value of
.Sq Li "Date:" .Sq Li Date\&:
and the Maildir flags according to the value of and the Maildir flags according to the value of
.Sq Li "Status:" .Sq Li Status\&:
or or
.Sq Li "X-Status:" . .Sq Li X-Status\&: .
.Pp .Pp
The messages are delivered in a reliable way and use default The messages are delivered in a reliable way and use default
.Xr umask 2 . .Xr umask 2 .

View File

@ -25,11 +25,11 @@ or uses the mails in the current sequence if used interactively.
.Pp .Pp
.Nm .Nm
uses the uses the
.Sq Li "Return-Path:" .Sq Li Return\&-Path\&:
(or (or
.Sq Li "X-Envelope-To:" ) .Sq Li X\&-Envelope\&-To\&: )
and and
.Sq Li "Date:" .Sq Li Date\&:
headers from the message for the mbox headers from the message for the mbox
.Sq Li "From " .Sq Li "From "
line. line.
@ -38,9 +38,9 @@ The options are as follows:
.Bl -tag -width Ds .Bl -tag -width Ds
.It Fl S .It Fl S
Add Add
.Sq Li "Status:" .Sq Li Status\&:
and and
.Sq Li "X-Status:" .Sq Li X\&-Status\&:
headers according to the headers according to the
.Ar msgs .Ar msgs
Maildir flags. Maildir flags.

View File

@ -1,4 +1,4 @@
.Dd July 26, 2017 .Dd September 6, 2017
.Dt MFLOW 1 .Dt MFLOW 1
.Os .Os
.Sh NAME .Sh NAME
@ -6,6 +6,9 @@
.Nd reflow format=flowed plain text mails .Nd reflow format=flowed plain text mails
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl f
.Op Fl q
.Op Fl w Ar width
\&< \&<
.Ar file .Ar file
.Sh DESCRIPTION .Sh DESCRIPTION
@ -31,6 +34,19 @@ If defined,
the environment variable the environment variable
.Ev MAXCOLUMNS .Ev MAXCOLUMNS
specifies the maximum line length. specifies the maximum line length.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl f
Force line wrapping of long lines.
.It Fl q
Prefix lines with
.Sq Li \&< .
Can be used multiple times.
.It Fl w Ar width
Set maximum line length to
.Ar width .
.El
.Sh EXIT STATUS .Sh EXIT STATUS
.Ex -std .Ex -std
.Sh SEE ALSO .Sh SEE ALSO

View File

@ -17,7 +17,7 @@ The fully qualified domain name is computed by:
.Bl -enum .Bl -enum
.It .It
Using Using
.Sq Li "FQDN:" .Sq Li FQDN\&:
from from
.Pa "${MBLAZE:-$HOME/.mblaze}/profile" .Pa "${MBLAZE:-$HOME/.mblaze}/profile"
(if set). (if set).
@ -25,7 +25,7 @@ from
Resolving the current hostname. Resolving the current hostname.
.It .It
Using the host part of the address in Using the host part of the address in
.Sq Li "Local-Mailbox:" .Sq Li Local\&-Mailbox\&:
from from
.Pa "${MBLAZE:-$HOME/.mblaze}/profile" .Pa "${MBLAZE:-$HOME/.mblaze}/profile"
(if set). (if set).

View File

@ -6,7 +6,7 @@
.Nd show mail headers .Nd show mail headers
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl h Ar header .Op Fl h Ar header Op Fl p Ar parameter
.Op Fl d .Op Fl d
.Op Fl H .Op Fl H
.Op Fl M .Op Fl M
@ -31,6 +31,10 @@ The options are as follows:
.It Fl h Ar header .It Fl h Ar header
Only print the values of the headers in the colon-separated list Only print the values of the headers in the colon-separated list
.Ar header . .Ar header .
.It Fl p Ar parameter
Extract a particular RFC 2045
.Ar parameter
from the specified headers.
.It Fl d .It Fl d
Decode the headers according to RFC 2047. Decode the headers according to RFC 2047.
.It Fl H .It Fl H
@ -55,6 +59,13 @@ and >1 if an error occurs.
.Rs .Rs
.%A N. Freed .%A N. Freed
.%A N. Borenstein .%A N. Borenstein
.%D November 1996
.%R RFC 2045
.%T Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies
.Re
.Rs
.%A N. Freed
.%A N. Borenstein
.%B MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text .%B MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text
.%R RFC 2047 .%R RFC 2047
.%D November 1996 .%D November 1996

View File

@ -72,8 +72,9 @@ Don't list messages in
Don't list messages in Don't list messages in
.Pa new . .Pa new .
.It Fl i .It Fl i
Don't print filenames. Instead, print a one-line summary for each Don't print filenames.
folder, showing the number of unseen, flagged and total messages, Instead, print a one-line summary for each folder,
showing the number of unseen, flagged and total messages,
along with the folder name. along with the folder name.
.Pp .Pp
If two or more folders are specified, a total will also be printed. If two or more folders are specified, a total will also be printed.

View File

@ -49,6 +49,8 @@ Defaults to
.Sh EXIT STATUS .Sh EXIT STATUS
.Ex -std .Ex -std
.Sh SEE ALSO .Sh SEE ALSO
.Xr makemime 1 ,
.Xr mhbuild 1
.Rs .Rs
.%A N. Freed .%A N. Freed
.%A N. Borenstein .%A N. Borenstein

View File

@ -74,7 +74,7 @@ Deleted messages.
New messages. New messages.
.It Cm o .It Cm o
Old messages. Old messages.
.It Cm r, Cm S .It Cm r , Cm S
Read messages. Read messages.
.It Cm u .It Cm u
Unread messages. Unread messages.

View File

@ -94,9 +94,9 @@ is greater or equal to 19,
seconds will also be shown. seconds will also be shown.
.It Cm "%" Ns Oo Ar wd Oc Ns Cm "f" .It Cm "%" Ns Oo Ar wd Oc Ns Cm "f"
The The
.Sq Li From: .Sq Li From\&:
(or (or
.Sq Li To: , .Sq Li To\&: ,
if the message is from us). if the message is from us).
.It Cm "%" Ns Oo Ar wd Oc Ns Cm "F" .It Cm "%" Ns Oo Ar wd Oc Ns Cm "F"
The Maildir folder the message resides in. The Maildir folder the message resides in.
@ -106,7 +106,7 @@ The Maildir folder the message resides in.
spaces per indentation depth in the thread tree. spaces per indentation depth in the thread tree.
.It Cm "%" Ns Oo Ar wd Oc Ns Cm "I" .It Cm "%" Ns Oo Ar wd Oc Ns Cm "I"
The The
.Sq Li "Message-ID:" .Sq Li Message\&-ID\&:
of the message. of the message.
.It Cm "%M" .It Cm "%M"
The raw Maildir flags of the message. The raw Maildir flags of the message.
@ -125,22 +125,22 @@ The subject of the message (defaults to remaining width).
.It Cm "%" Ns Oo Ar wd Oc Ns Cm "S" .It Cm "%" Ns Oo Ar wd Oc Ns Cm "S"
The subject of the message (defaults to remaining width), The subject of the message (defaults to remaining width),
with leading with leading
.Sq Li "Re:" , .Sq Li Re\&: ,
.Sq Li "Fwd:" .Sq Li Fwd\&:
etc. stripped. etc. stripped.
.It Cm "%t" .It Cm "%t"
A A
.Sq Li \&> .Sq Li \&>
if you are in if you are in
.Sq Li "To:" , .Sq Li To\&: ,
a a
.Sq Li \&+ .Sq Li \&+
if you are in if you are in
.Sq Li "Cc:" , .Sq Li Cc\&: ,
a a
.Sq Li \&: .Sq Li \&:
if you are in if you are in
.Sq Li "Resent-To:" , .Sq Li Resent\&-To\&: ,
or a blank. or a blank.
.It Cm "%u" .It Cm "%u"
An An
@ -169,13 +169,13 @@ A replied-to message
.Bl -tag -width 2n -compact .Bl -tag -width 2n -compact
.It Li \&> .It Li \&>
You are in You are in
.Sq Li "To:" . .Sq Li To\&: .
.It Li \&+ .It Li \&+
You are in You are in
.Sq Li "Cc:" . .Sq Li Cc\:& .
.It Li \&: .It Li \&:
You are in You are in
.Sq Li "Resent-To:" . .Sq Li Resent\&-To\&: .
.El .El
.Sh ENVIRONMENT .Sh ENVIRONMENT
.Bl -tag -width MBLAZE_PAGER .Bl -tag -width MBLAZE_PAGER

View File

@ -71,10 +71,10 @@ will delete all headers starting with
and and
.Sq Li "/from:to:cc/d" .Sq Li "/from:to:cc/d"
will delete the headers will delete the headers
.Sq Li "From:" , .Sq Li From\&: ,
.Sq Li "To:" , .Sq Li To\&: ,
and and
.Sq Li "Cc:" . .Sq Li Cc\&: .
.It Oo Cm \&/ Ns Ar headers Ns Cm \&/ Oc Ns Ic s Ns Cm \&/ Ns Ar regex Ns Cm \&/ Ns Ar replacement Ns Cm \&/ Ns Op Ar flags .It Oo Cm \&/ Ns Ar headers Ns Cm \&/ Oc Ns Ic s Ns Cm \&/ Ns Ar regex Ns Cm \&/ Ns Ar replacement Ns Cm \&/ Ns Op Ar flags
Substitute matches of the POSIX Basic Regular Expression Substitute matches of the POSIX Basic Regular Expression
.Ar regex .Ar regex

View File

@ -39,7 +39,7 @@ The options are as follows:
Display the headers in the colon-separated list Display the headers in the colon-separated list
.Ar headers , .Ar headers ,
instead of the default headers instead of the default headers
.Sq Li from:subject:to:cc:date:reply-to: . .Sq Li from\&:subject\&:to\&:cc\&:date\&:reply\&-to\&: .
.It Fl A Ar mimetypes .It Fl A Ar mimetypes
Define Define
.Sq Li "mixed/alternative" .Sq Li "mixed/alternative"

View File

@ -28,14 +28,14 @@ The options are as follows:
Reverse order. Reverse order.
.It Fl f .It Fl f
Sort by Sort by
.Sq Li From: . .Sq Li From\&: .
.It Fl d .It Fl d
Sort by date. Sort by date.
.It Fl s .It Fl s
Sort by Sort by
.Sq Li Subject\&: .Sq Li Subject\&:
(modulo various variants of (modulo various variants of
.Sq Li Re: ) . .Sq Li Re\&: ) .
.It Fl F .It Fl F
Sort by filename, using proper order for numbers in filenames. Sort by filename, using proper order for numbers in filenames.
.It Fl M .It Fl M

View File

@ -152,7 +152,7 @@ tryagain:
int i, j; int i, j;
for (i = sizeof statusflags - 1; i >= 0; i--) for (i = sizeof statusflags - 1; i >= 0; i--)
if (!statusflags[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]; statusflags[j-1] = statusflags[j];
if (Mflag) { if (Mflag) {
@ -189,7 +189,7 @@ main(int argc, char *argv[])
{ {
int c; int c;
while ((c = getopt(argc, argv, "cMvX:")) != -1) while ((c = getopt(argc, argv, "cMvX:")) != -1)
switch(c) { switch (c) {
case 'c': cflag = 1; break; case 'c': cflag = 1; break;
case 'M': Mflag = 1; break; case 'M': Mflag = 1; break;
case 'v': vflag = 1; break; case 'v': vflag = 1; break;

View File

@ -72,9 +72,9 @@ main(int argc, char *argv[])
{ {
int c, i; int c, i;
while ((c = getopt(argc, argv, "")) != -1) while ((c = getopt(argc, argv, "")) != -1)
switch(c) { switch (c) {
default: default:
usage: usage:
fprintf(stderr, "Usage: mdirs dirs...\n"); fprintf(stderr, "Usage: mdirs dirs...\n");
exit(1); exit(1);
} }

View File

@ -132,7 +132,7 @@ main(int argc, char *argv[])
{ {
int c; int c;
while ((c = getopt(argc, argv, "S")) != -1) while ((c = getopt(argc, argv, "S")) != -1)
switch(c) { switch (c) {
case 'S': Sflag = 1; break; case 'S': Sflag = 1; break;
default: default:
fprintf(stderr, "Usage: mexport [-S] [msgs...]\n"); fprintf(stderr, "Usage: mexport [-S] [msgs...]\n");

View File

@ -110,7 +110,7 @@ main(int argc, char *argv[])
{ {
int c; int c;
while ((c = getopt(argc, argv, "PRSTDFprstdfX:x:v")) != -1) 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': case 'P': case 'R': case 'S': case 'T': case 'D': case 'F':
flags[(unsigned int)c] = 1; flags[(unsigned int)c] = 1;
break; break;
@ -142,6 +142,11 @@ main(int argc, char *argv[])
curfile = blaze822_seq_cur(); curfile = blaze822_seq_cur();
if (vflag) { if (vflag) {
if (argc == optind && !isatty(0)) {
blaze822_loop(0, 0, flag); // read from stdin
return 0;
}
args = calloc(sizeof (char *), argsalloc); args = calloc(sizeof (char *), argsalloc);
if (!args) if (!args)
exit(-1); exit(-1);

42
mflow.c
View File

@ -32,7 +32,7 @@ fixed(int quotes, char *line, size_t linelen)
{ {
chgquote(quotes); chgquote(quotes);
if (linelen > (size_t)(maxcolumn - column)) { if (column && linelen > (size_t)(maxcolumn - column)) {
putchar('\n'); putchar('\n');
column = 0; column = 0;
} }
@ -75,7 +75,8 @@ flowed(int quotes, char *line, ssize_t linelen)
done = 1; done = 1;
} }
if (column + (eow - line) > maxcolumn) { if (column + (eow - line) > maxcolumn &&
eow - line < maxcolumn) {
putchar('\n'); putchar('\n');
column = 0; column = 0;
if (*line == ' ') { if (*line == ' ') {
@ -92,23 +93,26 @@ flowed(int quotes, char *line, ssize_t linelen)
} }
int int
main() main(int argc, char *argv[])
{ {
char *linebuf = 0; char *linebuf = 0;
char *line; char *line;
size_t linelen = 0; size_t linelen = 0;
int quotes = 0; int outer_quotes = 0;
int quotes;
int reflow = 1; // re-evaluated on $PIPE_CONTENTTYPE int reflow = 1; // re-evaluated on $PIPE_CONTENTTYPE
int force = 0;
int delsp = 0; int delsp = 0;
char *ct = getenv("PIPE_CONTENTTYPE"); char *ct = getenv("PIPE_CONTENTTYPE");
if (ct) { if (ct) {
char *s, *se; char *s, *se;
blaze822_mime_parameter(ct, "format", &s, &se); reflow = 0;
reflow = s && (strncasecmp(s, "flowed", 6) == 0); if (blaze822_mime_parameter(ct, "format", &s, &se) && s)
blaze822_mime_parameter(ct, "delsp", &s, &se); reflow = (strncasecmp(s, "flowed", 6) == 0);
delsp = s && (strncasecmp(s, "yes", 3) == 0); if (blaze822_mime_parameter(ct, "delsp", &s, &se) && s)
delsp = (strncasecmp(s, "yes", 3) == 0);
} }
char *cols = getenv("COLUMNS"); char *cols = getenv("COLUMNS");
@ -131,6 +135,17 @@ main()
maxcolumn = m; maxcolumn = m;
} }
int c;
while ((c = getopt(argc, argv, "fqw:")) != -1)
switch (c) {
case 'f': force = 1; break;
case 'q': outer_quotes++; break;
case 'w': maxcolumn = atoi(optarg); break;
default:
fprintf(stderr, "Usage: mflow [-f] [-q] [-w MAXCOLUMNS]\n");
exit(2);
}
while (1) { while (1) {
errno = 0; errno = 0;
ssize_t rd = getdelim(&linebuf, &linelen, '\n', stdin); ssize_t rd = getdelim(&linebuf, &linelen, '\n', stdin);
@ -144,7 +159,7 @@ main()
line = linebuf; line = linebuf;
if (!reflow) { if (!reflow && !force) {
fwrite(line, 1, rd, stdout); fwrite(line, 1, rd, stdout);
continue; continue;
} }
@ -154,14 +169,14 @@ main()
if (rd > 0 && line[rd-1] == '\r') if (rd > 0 && line[rd-1] == '\r')
line[--rd] = 0; line[--rd] = 0;
quotes = 0; quotes = outer_quotes;
while (*line == '>') { // measure quote depth while (*line == '>') { // measure quote depth
line++; line++;
quotes++; quotes++;
rd--; rd--;
} }
if (*line == ' ') { // space stuffing if (reflow && *line == ' ') { // space stuffing
line++; line++;
rd--; rd--;
} }
@ -177,10 +192,15 @@ main()
if (delsp) if (delsp)
line[--rd] = 0; line[--rd] = 0;
flowed(quotes, line, rd); flowed(quotes, line, rd);
} else {
if (force && rd > maxcolumn) {
flowed(quotes, line, rd);
fixed(quotes, "", 0);
} else { } else {
fixed(quotes, line, rd); fixed(quotes, line, rd);
} }
} }
}
if (reflow && column != 0) if (reflow && column != 0)
putchar('\n'); putchar('\n');

View File

@ -21,9 +21,10 @@ printb36(uint64_t x)
char outbuf[16]; char outbuf[16];
char *o = outbuf + sizeof outbuf; char *o = outbuf + sizeof outbuf;
*o = 0;
*--o = 0;
do { *--o = base36[x % 36]; } while (x /= 36); do { *--o = base36[x % 36]; } while (x /= 36);
fputs(o, stdout); fputs(o, stdout);
} }

18
mhdr.c
View File

@ -13,6 +13,7 @@
#include "blaze822.h" #include "blaze822.h"
static char *hflag; static char *hflag;
static char *pflag;
static int Aflag; static int Aflag;
static int Dflag; static int Dflag;
static int Hflag; static int Hflag;
@ -101,6 +102,16 @@ print_decode_header(char *s)
void void
print_header(char *v) print_header(char *v)
{ {
if (pflag) {
char *s, *se;
if (blaze822_mime_parameter(v, pflag, &s, &se)) {
*se = 0;
v = s;
} else {
return;
}
}
status = 0; status = 0;
if (Hflag && !Aflag) if (Hflag && !Aflag)
@ -189,9 +200,10 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
int c; int c;
while ((c = getopt(argc, argv, "h:ADHMd")) != -1) while ((c = getopt(argc, argv, "h:p:ADHMd")) != -1)
switch(c) { switch (c) {
case 'h': hflag = optarg; break; case 'h': hflag = optarg; break;
case 'p': pflag = optarg; break;
case 'A': Aflag = 1; break; case 'A': Aflag = 1; break;
case 'D': Dflag = 1; break; case 'D': Dflag = 1; break;
case 'H': Hflag = 1; break; case 'H': Hflag = 1; break;
@ -199,7 +211,7 @@ main(int argc, char *argv[])
case 'd': dflag = 1; break; case 'd': dflag = 1; break;
default: default:
fprintf(stderr, fprintf(stderr,
"Usage: mhdr [-h header] [-d] [-H] [-M] [-A|-D] [msgs...]\n"); "Usage: mhdr [-h header [-p parameter]] [-d] [-H] [-M] [-A|-D] [msgs...]\n");
exit(2); exit(2);
} }

4
minc.c
View File

@ -66,10 +66,10 @@ main(int argc, char *argv[])
{ {
int c, i; int c, i;
while ((c = getopt(argc, argv, "q")) != -1) while ((c = getopt(argc, argv, "q")) != -1)
switch(c) { switch (c) {
case 'q': qflag = 1; break; case 'q': qflag = 1; break;
default: default:
usage: usage:
fprintf(stderr, "Usage: minc [-q] dirs...\n"); fprintf(stderr, "Usage: minc [-q] dirs...\n");
exit(1); exit(1);
} }

View File

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

12
mmime.c
View File

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

26
mpick.c
View File

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

2
mquote
View File

@ -7,6 +7,6 @@
printf '%s wrote:\n' "$from" printf '%s wrote:\n' "$from"
mshow -R "$1" | mshow -R "$1" |
sed -n '/^-- $/!p;//q' | # strip signature sed -n '/^-- $/,$!p' | # strip signature
sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' | # strip empty lines sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' | # strip empty lines
sed 's/^/> /' # prefix with > sed 's/^/> /' # prefix with >

View File

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

6
msed.c
View File

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

8
mseq.c
View File

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

38
mshow.c
View File

@ -218,11 +218,14 @@ render_mime(int depth, struct message *msg, char *body, size_t bodylen)
size_t outlen; size_t outlen;
int e = filter(body, bodylen, cmd, &output, &outlen); int e = filter(body, bodylen, cmd, &output, &outlen);
if (e == 0) { // replace output if (e == 0 || e == 62) { // replace output (62 == raw)
if (!Nflag) if (!Nflag)
printf(" render=\"%s\" ---\n", cmd); printf(" render=\"%s\" ---\n", cmd);
if (outlen) { if (outlen) {
if (e == 0)
print_ascii(output, outlen); print_ascii(output, outlen);
else
return fwrite(output, 1, outlen, stdout);
if (output[outlen-1] != '\n') if (output[outlen-1] != '\n')
putchar('\n'); putchar('\n');
} }
@ -268,7 +271,7 @@ nofilter:
strcasecmp(charset, "utf8") == 0 || strcasecmp(charset, "utf8") == 0 ||
strcasecmp(charset, "us-ascii") == 0) { strcasecmp(charset, "us-ascii") == 0) {
print_ascii(body, bodylen); print_ascii(body, bodylen);
if (body[bodylen-1] != '\n') if (bodylen > 0 && body[bodylen-1] != '\n')
putchar('\n'); putchar('\n');
} else { } else {
print_u8recode(body, bodylen, charset); print_u8recode(body, bodylen, charset);
@ -336,7 +339,7 @@ choose_alternative(struct message *msg, int depth)
blaze822_mime_action blaze822_mime_action
reply_mime(int depth, struct message *msg, char *body, size_t bodylen) reply_mime(int depth, struct message *msg, char *body, size_t bodylen)
{ {
(void) depth; (void)depth;
char *ct = blaze822_hdr(msg, "content-type"); char *ct = blaze822_hdr(msg, "content-type");
char *mt = mimetype(ct); char *mt = mimetype(ct);
@ -365,7 +368,7 @@ reply_mime(int depth, struct message *msg, char *body, size_t bodylen)
blaze822_mime_action blaze822_mime_action
list_mime(int depth, struct message *msg, char *body, size_t bodylen) list_mime(int depth, struct message *msg, char *body, size_t bodylen)
{ {
(void) body; (void)body;
char *ct = blaze822_hdr(msg, "content-type"); char *ct = blaze822_hdr(msg, "content-type");
if (!ct) if (!ct)
@ -441,7 +444,7 @@ writefile(char *name, char *buf, ssize_t len)
blaze822_mime_action blaze822_mime_action
extract_mime(int depth, struct message *msg, char *body, size_t bodylen) extract_mime(int depth, struct message *msg, char *body, size_t bodylen)
{ {
(void) depth; (void)depth;
char *filename = mime_filename(msg); char *filename = mime_filename(msg);
@ -574,12 +577,12 @@ print_date_header(char *v)
int p = 3; int p = 3;
int z; int z;
switch(l) { switch (l) {
case 'y': case 'y':
z = d / (60*60*24*7*52); z = d / (60*60*24*7*52);
d = d % (60*60*24*7*52); d = d % (60*60*24*7*52);
if (z > 0) { if (z > 0) {
printf("%d year%s", z, z>1 ? "s" : ""); printf("%d year%s", z, z > 1 ? "s" : "");
if (!--p) break; if (!--p) break;
printf(", "); printf(", ");
} }
@ -588,7 +591,7 @@ print_date_header(char *v)
z = d / (60*60*24*7); z = d / (60*60*24*7);
d = d % (60*60*24*7); d = d % (60*60*24*7);
if (z > 0) { if (z > 0) {
printf("%d week%s", z, z>1 ? "s" : ""); printf("%d week%s", z, z > 1 ? "s" : "");
if (!--p) break; if (!--p) break;
printf(", "); printf(", ");
} }
@ -597,7 +600,7 @@ print_date_header(char *v)
z = d / (60*60*24); z = d / (60*60*24);
d = d % (60*60*24); d = d % (60*60*24);
if (z > 0) { if (z > 0) {
printf("%d day%s", z, z>1 ? "s" : ""); printf("%d day%s", z, z > 1 ? "s" : "");
if (!--p) break; if (!--p) break;
printf(", "); printf(", ");
} }
@ -606,7 +609,7 @@ print_date_header(char *v)
z = d / (60*60); z = d / (60*60);
d = d % (60*60); d = d % (60*60);
if (z > 0) { if (z > 0) {
printf("%d hour%s", z, z>1 ? "s" : ""); printf("%d hour%s", z, z > 1 ? "s" : "");
if (!--p) break; if (!--p) break;
printf(", "); printf(", ");
} }
@ -615,14 +618,14 @@ print_date_header(char *v)
z = d / (60); z = d / (60);
d = d % (60); d = d % (60);
if (z > 0) { if (z > 0) {
printf("%d minute%s", z, z>1 ? "s" : ""); printf("%d minute%s", z, z > 1 ? "s" : "");
if (!--p) break; if (!--p) break;
printf(", "); printf(", ");
} }
/* FALL THROUGH */ /* FALL THROUGH */
case 's': case 's':
z = d; z = d;
printf("%d second%s", z, z>1 ? "s" : ""); printf("%d second%s", z, z > 1 ? "s" : "");
} }
if (t < now) if (t < now)
@ -707,7 +710,7 @@ show(char *file)
printf("\n"); printf("\n");
if (rflag || !blaze822_check_mime(msg)) { // raw body if (rflag) { // raw body
print_ascii(blaze822_body(msg), blaze822_bodylen(msg)); print_ascii(blaze822_body(msg), blaze822_bodylen(msg));
goto done; goto done;
} }
@ -726,7 +729,7 @@ main(int argc, char *argv[])
int c; int c;
while ((c = getopt(argc, argv, "h:A:qrtHLNx:O:Rn")) != -1) while ((c = getopt(argc, argv, "h:A:qrtHLNx:O:Rn")) != -1)
switch(c) { switch (c) {
case 'h': hflag = optarg; break; case 'h': hflag = optarg; break;
case 'A': Aflag = optarg; break; case 'A': Aflag = optarg; break;
case 'q': qflag = 1; break; case 'q': qflag = 1; break;
@ -759,8 +762,13 @@ main(int argc, char *argv[])
if (safe_output && isatty(1)) { if (safe_output && isatty(1)) {
char *pg; char *pg;
pg = getenv("MBLAZE_PAGER"); pg = getenv("MBLAZE_PAGER");
if (!pg) if (!pg) {
pg = getenv("PAGER"); pg = getenv("PAGER");
if (pg && strcmp(pg, "less") == 0) {
static char lesscmd[] = "less -RFXe";
pg = lesscmd;
}
}
if (pg && *pg && strcmp(pg, "cat") != 0) { if (pg && *pg && strcmp(pg, "cat") != 0) {
pid2 = pipeto(pg); pid2 = pipeto(pg);
if (pid2 < 0) if (pid2 < 0)

View File

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

View File

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

View File

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

View File

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

View File

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