summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-01-27 15:59:46 -0500
committerJune McEnroe <june@causal.agency>2020-01-27 15:59:46 -0500
commita0c11b5432eed2d7bfc24f489425b030b5346bfc (patch)
tree0931d5b16e9ead764b57f7f90813ad7ab53eca60
parentSkip notes not listed in args (diff)
downloadnotemap-a0c11b5432eed2d7bfc24f489425b030b5346bfc.tar.gz
notemap-a0c11b5432eed2d7bfc24f489425b030b5346bfc.zip
Encode trailing whitespace in quote-printable properly
Diffstat (limited to '')
-rw-r--r--notemap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/notemap.c b/notemap.c
index 5f35794..c7f116f 100644
--- a/notemap.c
+++ b/notemap.c
@@ -246,14 +246,14 @@ static void append(
 
 	int ch;
 	int len = 0;
+	bool ws = false;
 	while (EOF != (ch = fgetc(note))) {
 		if (len == 76 && ch != '\n') {
 			fprintf(msg, "=\r\n");
 			len = 0;
 		}
 		if (ch == '\n') {
-			// TODO: Check if last character was space or tab.
-			fprintf(msg, "\r\n");
+			fprintf(msg, "%s\r\n", (ws ? "=\r\n" : ""));
 			len = 0;
 		} else if (ch == '\t' || (ch >= ' ' && ch <= '~' && ch != '=')) {
 			fprintf(msg, "%c", ch);
@@ -262,6 +262,7 @@ static void append(
 			fprintf(msg, "=%02X", ch);
 			len += 3;
 		}
+		ws = (ch == '\t' || ch == ' ');
 	}
 	if (ferror(note)) err(EX_IOERR, "%s", path);
 	fclose(note);
a href='/src/commit/txt/books.txt?id=0b699d278c4441b690d4c810a971e118d28b1d80&follow=1'>Add Fierce Femmes and Notorious LiarsJune McEnroe 2020-02-23Add This Is How You Lose the Time WarJune McEnroe 2020-02-22Add See Ya LaterJune McEnroe 2020-02-20Remove wiki scriptJune McEnroe 2020-02-19Add The Obelisk GateJune McEnroe 2020-02-17Add Four Tet — HandsJune McEnroe 2020-02-12Simplify macOS notify-sendJune McEnroe 2020-02-12Add imbox and notemap to pageJune McEnroe 2020-02-12Collapse simple linksJune McEnroe 2020-02-12Move catgirl up the pageJune McEnroe 2020-02-12Update catgirl pty grabJune McEnroe 2020-02-12Link to cgit /about pages where appropriateJune McEnroe 2020-02-11Separate LINKS from BINS for html to workJune McEnroe 2020-02-11Add margin to Bl-bullet itemsJune McEnroe 2020-02-10Match URLs inside parens or with paired parens insideJune McEnroe 2020-02-10Duplicate effective URL before passing it back to curlJune McEnroe 2020-02-09Add To Be Taught, If FortunateJune McEnroe 2020-02-04Add The Future of Another TimelineJune McEnroe 2020-01-31Reorganize the Makefile for the umpteenth timeJune McEnroe 2020-01-28Change scout sensitivity to 1.4June McEnroe 2020-01-28Import shows.txtJune McEnroe