Commit Diff


commit - 7de68a820ba0321f608bf67e31bbd1750d9569ce
commit + 52ec20aed48036d6ead6648e4cb4aaac0a306ebd
blob - 679c889ec81c97f40d2247149aac36ac37dde357
blob + af593b320c54c49656560750b987798cb18cda5f
--- mailcap.c
+++ mailcap.c
@@ -69,9 +69,7 @@ static const char *default_mailcaps[] = {
 enum mailcap_section {
 	MAILCAP_MIME = 0,
 	MAILCAP_CMD,
-	MAILCAP_FLAGS_1,
-	MAILCAP_FLAGS_2,
-	MAILCAP_END_OF_FIELDS,
+	MAILCAP_FLAGS,
 };
 
 static char *
@@ -319,28 +317,26 @@ static int
 parse_mailcap_line(char *input)
 {
 	struct mailcap		*mc;
-	int	 		 ms;
+	int	 		 ms = 0;
 	char			*line = NULL;
 
 	mc = mailcap_new();
 
-	for (ms = MAILCAP_MIME; ms < MAILCAP_END_OF_FIELDS; ms++) {
-		if ((line = strsep(&input, ";")) == NULL)
-			break;
-
+	while ((line = strsep(&input, ";")) != NULL) {
 		line = str_trim_whitespace(line);
 
 		switch (ms) {
 		case MAILCAP_MIME:
 			if ((mc->mime_type = strdup(line)) == NULL)
 				errx(1, "strdup");
+			ms++;
 			break;
 		case MAILCAP_CMD:
 			if ((mc->cmd = strdup(line)) == NULL)
 				errx(1, "strdup");
+			ms++;
 			break;
-		case MAILCAP_FLAGS_1:
-		case MAILCAP_FLAGS_2:
+		case MAILCAP_FLAGS:
 			if (strcmp(line, "needsterminal") == 0)
 				mc->flags |= MAILCAP_NEEDSTERMINAL;
 			if (strcmp(line, "copiousoutput") == 0)
blob - b6517c9a69a3e43dfa49085d96cda99e750c0a22
blob + 8737d9928f80942ade1b273f198a13892b7d9447
--- test/mc.exp.many
+++ test/mc.exp.many
@@ -1,3 +1,4 @@
 video/x-youtube; mpv -quiet '%s'; needsterminal
 video/*; mpv -quiet '%s'; needsterminal
 image/*; xdg-open %s
+text/html; mutt-browser '%s'; needsterminal; copiousoutput
blob - a2a15cbd7260ce0cfb1648b30af45b070e697023
blob + 1bd1e43e55aea1c49dd122796f9db4c8145aacb5
--- test/mc.test.many
+++ test/mc.test.many
@@ -2,3 +2,4 @@
 video/x-youtube; mpv -quiet '%s'; needsterminal
 video/*; mpv -quiet '%s'; needsterminal
 image/*; xdg-open %s
+text/html; mutt-browser '%s'; copiousoutput; test=test -n "$DISPLAY"; needsterminal;