about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2021-06-18 01:55:07 +0200
committerLeah Neukirchen <leah@vuxu.org>2021-06-18 01:57:49 +0200
commitd324b92dd48e6eabdb3cf0cb2aecfff21cc24614 (patch)
tree5d0ab41d3fea294fd27bc2a59a06064b8b8e71d9
parent037091635712d242179676325d1f396aaf93c9fc (diff)
downloadmblaze-d324b92dd48e6eabdb3cf0cb2aecfff21cc24614.tar.gz
mblaze-d324b92dd48e6eabdb3cf0cb2aecfff21cc24614.tar.xz
mblaze-d324b92dd48e6eabdb3cf0cb2aecfff21cc24614.zip
mmime: keep (none) whitespace after quoted strings
-rw-r--r--mmime.c4
1 files changed, 3 insertions, 1 deletions
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");