mblaze

Unix utilities to deal with Maildir - my mirror
git clone https://pi.duncano.de/git/mblaze.git
Log | Files | Refs | README | COPYING

commit 2776c838fe43e56260f44f63b12536bd41787d8c
parent 5eb7837aa8706b0050dee2fd6a2eb5d41510d18d
Author: Christian Neukirchen <chneukirchen@gmail.com>
Date:   Sat,  6 Aug 2016 19:30:45 +0200

mshow: extract headers with -H -O

Diffstat:
man/mshow.1 | 5++++-
mshow.c | 12++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/man/mshow.1 b/man/mshow.1 @@ -74,7 +74,10 @@ pattern. .It Fl O Ar msg Like .Fl x -but extract to standard output. +but write to standard output. +When used together with +.Fl H , +print the headers of the MIME part too. .It Fl t Switch to list mode: list all MIME parts of each diff --git a/mshow.c b/mshow.c @@ -443,6 +443,12 @@ extract_mime(int depth, struct message *msg, char *body, size_t bodylen) if (errno == 0 && !*b && d == mimecount) { // extract by id if (extract_stdout) { + if (Hflag) { + fwrite(blaze822_orig_header(msg), + 1, blaze822_headerlen(msg), + stdout); + printf("\n\n"); + } fwrite(body, 1, bodylen, stdout); } else { char buf[255]; @@ -461,6 +467,12 @@ extract_mime(int depth, struct message *msg, char *body, size_t bodylen) fnmatch(a, filename, FNM_PATHNAME) == 0) { // extract by name if (extract_stdout) { + if (Hflag) { + fwrite(blaze822_orig_header(msg), + 1, blaze822_headerlen(msg), + stdout); + printf("\n\n"); + } fwrite(body, 1, bodylen, stdout); } else { printf("%s\n", filename);