mshow: add -B to decode MIME parameters in broken mails

pull/118/head
Leah Neukirchen 6 years ago
parent 5d43ad2404
commit d261b0cdcf

@ -1,4 +1,4 @@
.Dd July 22, 2016 .Dd April 17, 2018
.Dt MSHOW 1 .Dt MSHOW 1
.Os .Os
.Sh NAME .Sh NAME
@ -8,7 +8,7 @@
.Nm .Nm
.Op Fl h Ar headers .Op Fl h Ar headers
.Op Fl A Ar mimetypes .Op Fl A Ar mimetypes
.Op Fl nqrFHLN .Op Fl nqrBFHLN
.Op Ar msgs\ ... .Op Ar msgs\ ...
.Nm .Nm
.Fl x Ar msg .Fl x Ar msg
@ -67,6 +67,11 @@ Don't render the body, stop after header output.
.It Fl r .It Fl r
Don't render the body, print raw body. Don't render the body, print raw body.
This may be dangerous to use on a tty. This may be dangerous to use on a tty.
.It Fl B
Decode encoded-words also in MIME parameters in direct violation
of RFC 2047.
This is useful if the attachment names look like
.Sq Li =?UTF-8?Q?stuff?= .
.It Fl F .It Fl F
Don't apply filters to MIME parts. Don't apply filters to MIME parts.
.It Fl H .It Fl H

@ -15,6 +15,7 @@
#include "blaze822.h" #include "blaze822.h"
static int Bflag;
static int rflag; static int rflag;
static int Rflag; static int Rflag;
static int qflag; static int qflag;
@ -166,6 +167,12 @@ mime_filename(struct message *msg)
filename = buf; filename = buf;
} }
if (Bflag && filename) {
static char buf2[512];
blaze822_decode_rfc2047(buf2, filename, sizeof buf2, "UTF-8");
filename = buf2;
}
return filename; return filename;
} }
@ -743,10 +750,11 @@ main(int argc, char *argv[])
pid_t pid1 = -1, pid2 = -1; pid_t pid1 = -1, pid2 = -1;
int c; int c;
while ((c = getopt(argc, argv, "h:A:qrtFHLNx:O:Rn")) != -1) while ((c = getopt(argc, argv, "h:A:BqrtFHLNx: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 'B': Bflag = 1; break;
case 'q': qflag = 1; break; case 'q': qflag = 1; break;
case 'r': rflag = 1; break; case 'r': rflag = 1; break;
case 'F': Fflag = 1; break; case 'F': Fflag = 1; break;

Loading…
Cancel
Save