From d324b92dd48e6eabdb3cf0cb2aecfff21cc24614 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Fri, 18 Jun 2021 01:55:07 +0200 Subject: [PATCH] mmime: keep (none) whitespace after quoted strings --- mmime.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mmime.c b/mmime.c index 2f0636a..7d47a20 100644 --- a/mmime.c +++ b/mmime.c @@ -312,6 +312,7 @@ print_header(char *line) { } int prevq = 0; // was the previous word encoded as qp? + char prevqs = 0; // was the previous word a quoted-string? ssize_t linelen = s - line; @@ -354,7 +355,7 @@ print_header(char *line) { // space at beginning of line goto force_qp; } - if (*s != ' ') { + if (*s != ' ' && !(prevqs && !prevq && *(s-1) != ' ')) { printf(" "); linelen++; } @@ -388,6 +389,7 @@ force_qp: if (qs && *e == '"') e++; } + prevqs = qs; s = e; } printf("\n");