From 0ce958a22c82d45b4b0ce77dbcac2fd6f6822965 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Mon, 1 Aug 2016 14:26:37 +0200 Subject: mmime: only qp after newline when actually needed --- mmime.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'mmime.c') diff --git a/mmime.c b/mmime.c index 5e25082..c46b0a5 100644 --- a/mmime.c +++ b/mmime.c @@ -245,13 +245,19 @@ print_header(char *line) { } if (s < e) { if (linelen + (e-s)+13 > 78) { - printf("\n"); - linelen = 0; + printf("\n "); + linelen = 1; + } + if (highbit || s[0] == ' ') { + printf("=?UTF-8?Q?"); + linelen += 13; + linelen += gen_qp((uint8_t *)s, e-s, 999, 1); + printf("?="); + } else { + fwrite(s, 1, e-s, stdout); + linelen += e-s; + prevq = 0; } - printf(" =?UTF-8?Q?"); - linelen += 13; - linelen += gen_qp((uint8_t *)s, e-s, 999, 1); - printf("?="); } prevq = 1; } else { -- cgit 1.4.1