From: David Levine Date: Sun, 12 May 2013 13:29:34 +0000 (-0500) Subject: Fixed strip_crs() in mhfixmsg to work even if it's the X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/902e700b1d5ba0112fb92c25e6092a88d4789f6a?ds=inline;hp=-c Fixed strip_crs() in mhfixmsg to work even if it's the only modification to the message. Also, fixed the test so that it succeeds even if there is no lynx, w3m, etc. --- 902e700b1d5ba0112fb92c25e6092a88d4789f6a diff --git a/test/mhfixmsg/test-mhfixmsg b/test/mhfixmsg/test-mhfixmsg index 9f9f69b6..3bffa9a8 100755 --- a/test/mhfixmsg/test-mhfixmsg +++ b/test/mhfixmsg/test-mhfixmsg @@ -666,9 +666,14 @@ d> EOF -#### lynx inserts multiple blank lines, so use uniq to squeeze them. -mhfixmsg last -outfile - | uniq >"$actual" -check "$expected" "$actual" 'ignore space' +if [ $can_reformat_texthtml -eq 1 ]; then + #### lynx inserts multiple blank lines, so use uniq to squeeze them. + mhfixmsg last -outfile - | uniq >"$actual" + check "$expected" "$actual" 'ignore space' +else + cp -p "$MH_TEST_DIR/Mail/inbox/15" "$MH_TEST_DIR/Mail/inbox/15.backup" + rm -f "$expected" +fi # check -textcodeset @@ -869,6 +874,7 @@ else rm -f "$expected" fi + # check handling of rfc822 message type cat >"$expected" < diff --git a/uip/mhfixmsg.c b/uip/mhfixmsg.c index 1c3a632e..2714024d 100644 --- a/uip/mhfixmsg.c +++ b/uip/mhfixmsg.c @@ -103,7 +103,7 @@ static void transfer_noncontent_headers (CT, CT); static int set_ct_type (CT, int type, int subtype, int encoding); static int decode_text_parts (CT, int, int *); static int content_encoding (CT); -static int strip_crs (CT); +static int strip_crs (CT, int *); static int convert_codesets (CT, char *, int *); static int convert_codeset (CT, char *, int *); static char *content_codeset (CT); @@ -1485,7 +1485,7 @@ decode_text_parts (CT ct, int encoding, int *message_mods) { report (ct->c_partno, ct->c_file, "decode%s", ct->c_ctline ? ct->c_ctline : ""); } - strip_crs (ct); + strip_crs (ct, message_mods); } else { status = NOTOK; } @@ -1497,7 +1497,7 @@ decode_text_parts (CT ct, int encoding, int *message_mods) { } case CE_8BIT: case CE_7BIT: - strip_crs (ct); + strip_crs (ct, message_mods); break; default: break; @@ -1583,7 +1583,7 @@ content_encoding (CT ct) { static int -strip_crs (CT ct) { +strip_crs (CT ct, int *message_mods) { /* norm_charmap() is case sensitive. */ char *codeset = upcase (content_codeset (ct)); int status = OK; @@ -1691,6 +1691,11 @@ strip_crs (CT ct) { } ct->c_cefile.ce_file = stripped_content_file; ct->c_cefile.ce_unlink = 1; + + ++*message_mods; + if (verbosw) { + report (NULL, *file, "stripped CRs"); + } } }