mshow: ensure plain text output ends with a newline

pull/2/head
Christian Neukirchen 8 years ago
parent d233737be4
commit d779211dc7

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

Loading…
Cancel
Save