diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2016-08-09 20:53:43 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2016-08-09 20:53:43 +0200 |
commit | d779211dc7173d3eb3628930a3f81b5d201919ff (patch) | |
tree | 454895bf5240b288488d5f4bd5ac9a9753374501 /mshow.c | |
parent | d233737be4a91daff5fe6bb17a06a16f7fc34266 (diff) | |
download | mblaze-d779211dc7173d3eb3628930a3f81b5d201919ff.tar.gz mblaze-d779211dc7173d3eb3628930a3f81b5d201919ff.tar.xz mblaze-d779211dc7173d3eb3628930a3f81b5d201919ff.zip |
mshow: ensure plain text output ends with a newline
Diffstat (limited to 'mshow.c')
-rw-r--r-- | mshow.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/mshow.c b/mshow.c index f836b76..2111512 100644 --- 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); |