mblaze

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

commit d779211dc7173d3eb3628930a3f81b5d201919ff
parent d233737be4a91daff5fe6bb17a06a16f7fc34266
Author: Christian Neukirchen <chneukirchen@gmail.com>
Date:   Tue,  9 Aug 2016 20:53:43 +0200

mshow: ensure plain text output ends with a newline

Diffstat:
mshow.c | 12++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/mshow.c b/mshow.c @@ -45,9 +45,8 @@ printhdr(char *hdr) hdr++; } - if (*hdr) { + if (*hdr) printf("%s\n", hdr); - } } int @@ -205,6 +204,8 @@ render_mime(int depth, struct message *msg, char *body, size_t bodylen) if (e == 0) { // replace output printf(" render=\"%s\" ---\n", cmd); print_ascii(output, outlen); + if (output[outlen-1] != '\n') + putchar('\n'); } else if (e == 63) { // skip filter free(output); goto nofilter; @@ -243,10 +244,13 @@ nofilter: if (!charset || strcasecmp(charset, "utf-8") == 0 || strcasecmp(charset, "utf8") == 0 || - strcasecmp(charset, "us-ascii") == 0) + strcasecmp(charset, "us-ascii") == 0) { print_ascii(body, bodylen); - else + if (body[bodylen-1] != '\n') + putchar('\n'); + } else { print_u8recode(body, bodylen, charset); + } free(charset); } else if (strncmp(ct, "message/rfc822", 14) == 0) { struct message *imsg = blaze822_mem(body, bodylen);