mirror of
https://github.com/leahneukirchen/mblaze
synced 2024-11-07 15:20:37 +00:00
Merge branch 'master' of https://github.com/chneukirchen/mblaze
This commit is contained in:
commit
aaa94a65c8
@ -33,6 +33,7 @@ mshow : filter.o safe_u8putstr.o rfc2231.o pipeto.o
|
||||
mscan : pipeto.o
|
||||
msort : mystrverscmp.o
|
||||
mmime : slurp.o
|
||||
minc mlist : squeeze_slash.o
|
||||
|
||||
museragent: FRC
|
||||
@printf '#!/bin/sh\nprintf "User-Agent: mblaze/%s (%s)\\n"\n' \
|
||||
|
@ -97,3 +97,6 @@ void safe_u8putstr(char *s0, size_t l, FILE *stream);
|
||||
pid_t pipeto(const char *cmdline);
|
||||
int pipeclose(pid_t pid);
|
||||
|
||||
// squeeze_slash.c
|
||||
|
||||
void squeeze_slash(char *);
|
||||
|
@ -13,7 +13,7 @@
|
||||
prints the messages
|
||||
.Ar msgs
|
||||
with mail headers transformed by the commands in
|
||||
.Ar scripts .
|
||||
.Ar script .
|
||||
See
|
||||
.Xr mmsg 7
|
||||
for the message argument syntax.
|
||||
@ -29,8 +29,8 @@ scripts are akin to a subset of
|
||||
scripts, but optimized for modifying mail.
|
||||
Note that
|
||||
.Nm
|
||||
unfolds and normalizes the mail headers, so they may need to be
|
||||
passed through
|
||||
unfolds and normalizes mail headers,
|
||||
so they may need to be passed through
|
||||
.Xr mmime 7
|
||||
to ensure RFC 5322 conformance.
|
||||
The mail body is copied as-is.
|
||||
|
19
man/mshow.1
19
man/mshow.1
@ -25,18 +25,19 @@
|
||||
.Sh DESCRIPTION
|
||||
By default,
|
||||
.Nm
|
||||
renders the passed messages to standard output.
|
||||
renders the specified messages to the standard output.
|
||||
See
|
||||
.Xr mmsg 7
|
||||
for the message argument syntax.
|
||||
If used interactively and no messages are given,
|
||||
If used interactively, and no messages are specified,
|
||||
.Nm
|
||||
displays the current message using colorization and a pager.
|
||||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width Ds
|
||||
.It Fl h Ar headers
|
||||
Display the headers in the colon-separated list
|
||||
.Ar headers
|
||||
.Ar headers ,
|
||||
instead of the default headers
|
||||
.Sq Li from:subject:to:cc:date:reply-to: .
|
||||
.It Fl A Ar mimetypes
|
||||
@ -45,8 +46,9 @@ Define
|
||||
preference.
|
||||
.Ar mimetypes
|
||||
is a colon-separated list of
|
||||
MIME types, the ones appearing first will
|
||||
be preferred when rendering
|
||||
MIME types which will be preferred,
|
||||
in the order given,
|
||||
when rendering
|
||||
.Sq Li "mixed/alternative"
|
||||
parts.
|
||||
If no MIME type matches, the first MIME part will be rendered.
|
||||
@ -97,10 +99,11 @@ Render the text parts from
|
||||
suitable for use in a reply.
|
||||
.El
|
||||
.Sh FILTERS
|
||||
.Nm
|
||||
by default decodes all
|
||||
.Nm ,
|
||||
by default, decodes all
|
||||
.Sq Li text/* ,
|
||||
.Sq Li message/rfc822 ,
|
||||
.Sq Li message/rfc822
|
||||
and
|
||||
.Sq Li multipart/*
|
||||
parts,
|
||||
and re-encodes them into UTF-8 if necessary.
|
||||
|
10
man/msort.1
10
man/msort.1
@ -11,19 +11,17 @@
|
||||
.Op Ar msgs\ ...
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
sorts mail messages according to various orders.
|
||||
sorts mail messages according to various orders,
|
||||
and prints, one per line, the sorted message names.
|
||||
See
|
||||
.Xr mmsg 7
|
||||
for the message argument syntax.
|
||||
.Pp
|
||||
If no messages are passed,
|
||||
If no messages are specified,
|
||||
.Nm
|
||||
will read filenames from standard input,
|
||||
will read filenames from the standard input,
|
||||
or use the default sequence if used interactively.
|
||||
.Pp
|
||||
.Nm
|
||||
prints the sorted messages line by line.
|
||||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width Ds
|
||||
.It Fl r
|
||||
|
@ -11,20 +11,20 @@
|
||||
.Op Ar msgs\ ...
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
groups messages together in parent/child relationships based on
|
||||
groups messages together in parent/child relationships, based on
|
||||
which messages are replies to which others.
|
||||
See
|
||||
.Xr mmsg 7
|
||||
for the message argument syntax.
|
||||
.Pp
|
||||
If no messages are passed,
|
||||
If no messages are specified,
|
||||
.Nm
|
||||
will read filenames from standard input,
|
||||
will read filenames from the standard input,
|
||||
or use the default sequence if used interactively.
|
||||
.Pp
|
||||
.Nm
|
||||
prints the threaded messages line by line, indented according to their
|
||||
depth in the message tree.
|
||||
prints the threaded messages one per line,
|
||||
indented according to their depth in the message tree.
|
||||
Unresolved Message-IDs are printed as-is.
|
||||
.Pp
|
||||
The options are as follows:
|
||||
@ -34,12 +34,13 @@ Do not prune unresolved Message-IDs at the top-level.
|
||||
.It Fl S Ar msg
|
||||
Treat
|
||||
.Ar msg
|
||||
as optional message(s) that will be added to threads only in case they
|
||||
as optional message(s) that will be added to threads only if they
|
||||
are referenced.
|
||||
Threads where all messages are optional are suppressed.
|
||||
You can use
|
||||
.Fl S
|
||||
to add outbox folders and complete threads where your replies were missing.
|
||||
to add an outbox folder, for example,
|
||||
completing threads where your replies were missing.
|
||||
.El
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std
|
||||
|
5
mcom
5
mcom
@ -13,7 +13,8 @@ notmine() {
|
||||
}
|
||||
|
||||
reffmt() {
|
||||
sed 's/^[^<]*//g;s/[^>]*$//g;s/>[^<]*</>\n</g' | uniq | sed 's/^/ /'
|
||||
sed 's/^[^<]*//g;s/[^>]*$//g;s/>[^<]*</>\
|
||||
</g' | uniq | sed 's/^/ /'
|
||||
}
|
||||
|
||||
msgid() {
|
||||
@ -144,7 +145,7 @@ fi
|
||||
cat "$MBLAZE/headers" 2>/dev/null
|
||||
mid=$(mhdr -h message-id "$1")
|
||||
if [ "$mid" ]; then
|
||||
printf 'References: '
|
||||
printf 'References:'
|
||||
{
|
||||
mhdr -h references "$1"
|
||||
printf '%s\n' "$mid"
|
||||
|
4
minc.c
4
minc.c
@ -24,11 +24,13 @@ inc(char *dir)
|
||||
char src[PATH_MAX];
|
||||
char dst[PATH_MAX];
|
||||
|
||||
squeeze_slash(dir);
|
||||
|
||||
snprintf(src, sizeof src, "%s/new", dir);
|
||||
fd = opendir(src);
|
||||
if (!fd) {
|
||||
fprintf(stderr, "minc: can't open maildir '%s': %s\n",
|
||||
dir, strerror(errno));
|
||||
src, strerror(errno));
|
||||
status = 2;
|
||||
return;
|
||||
}
|
||||
|
2
mlist.c
2
mlist.c
@ -169,6 +169,8 @@ listdir(char *dir)
|
||||
void
|
||||
listarg(char *arg)
|
||||
{
|
||||
squeeze_slash(arg);
|
||||
|
||||
struct stat st;
|
||||
if (stat(arg, &st) < 0)
|
||||
return;
|
||||
|
8
mmime.c
8
mmime.c
@ -222,6 +222,14 @@ gen_file(char *file, char *ct)
|
||||
|
||||
gen_attachment(filename, cd);
|
||||
|
||||
if (strcmp(ct, "message/rfc822") == 0) {
|
||||
printf("Content-Type: %s\n", ct);
|
||||
printf("Content-Transfer-Encoding: %dbit\n\n",
|
||||
(bitlow > 0 || bithigh > 0) ? 8 : 7);
|
||||
fwrite(content, 1, size, stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (bitlow == 0 && bithigh == 0 &&
|
||||
maxlinelen <= 78 && content[size-1] == '\n') {
|
||||
if (!ct)
|
||||
|
25
mymemmem.c
25
mymemmem.c
@ -1,5 +1,5 @@
|
||||
// taken straight from musl@c718f9fc
|
||||
// twobyte_memmem fixed to avoid 1 byte read over end of buffer
|
||||
// incooperates fix from <20170629213533.18744-1-amonakov@ispras.ru>
|
||||
|
||||
/*
|
||||
Copyright © 2005-2014 Rich Felker, et al.
|
||||
@ -30,32 +30,27 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
static char *twobyte_memmem(const unsigned char *h, size_t k, const unsigned char *n)
|
||||
{
|
||||
uint16_t nw = n[0]<<8 | n[1], hw = h[0]<<8 | h[1];
|
||||
h++;
|
||||
k--;
|
||||
for (;;) {
|
||||
if (hw == nw) return (char *)h-1;
|
||||
if (!--k) return 0;
|
||||
hw = hw<<8 | *++h;
|
||||
}
|
||||
return 0;
|
||||
for (h+=2, k-=2; k; k--, hw = hw<<8 | *h++)
|
||||
if (hw == nw) return (char *)h-2;
|
||||
return hw == nw ? (char *)h-2 : 0;
|
||||
}
|
||||
|
||||
static char *threebyte_memmem(const unsigned char *h, size_t k, const unsigned char *n)
|
||||
{
|
||||
uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8;
|
||||
uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8;
|
||||
for (h+=2, k-=2; k; k--, hw = (hw|*++h)<<8)
|
||||
if (hw == nw) return (char *)h-2;
|
||||
return 0;
|
||||
for (h+=3, k-=3; k; k--, hw = (hw|*h++)<<8)
|
||||
if (hw == nw) return (char *)h-3;
|
||||
return hw == nw ? (char *)h-3 : 0;
|
||||
}
|
||||
|
||||
static char *fourbyte_memmem(const unsigned char *h, size_t k, const unsigned char *n)
|
||||
{
|
||||
uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8 | n[3];
|
||||
uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8 | h[3];
|
||||
for (h+=3, k-=3; k; k--, hw = hw<<8 | *++h)
|
||||
if (hw == nw) return (char *)h-3;
|
||||
return 0;
|
||||
for (h+=4, k-=4; k; k--, hw = hw<<8 | *h++)
|
||||
if (hw == nw) return (char *)h-4;
|
||||
return hw == nw ? (char *)h-4 : 0;
|
||||
}
|
||||
|
||||
#define MAX(a,b) ((a)>(b)?(a):(b))
|
||||
|
15
squeeze_slash.c
Normal file
15
squeeze_slash.c
Normal file
@ -0,0 +1,15 @@
|
||||
void
|
||||
squeeze_slash(char *arg) {
|
||||
char *s, *t;
|
||||
|
||||
// squeeze slashes
|
||||
s = t = arg;
|
||||
while ((*s++ = *t))
|
||||
while (*t++ == '/' && *t == '/')
|
||||
;
|
||||
|
||||
// remove trailing slashes
|
||||
s--;
|
||||
while (*--s == '/')
|
||||
*s = 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user