]> diplodocus.org Git - nmh/commitdiff
Fixed strip_crs() in mhfixmsg to work even if it's the
authorDavid Levine <levinedl@acm.org>
Sun, 12 May 2013 13:29:34 +0000 (08:29 -0500)
committerDavid Levine <levinedl@acm.org>
Sun, 12 May 2013 13:29:34 +0000 (08:29 -0500)
only modification to the message.  Also, fixed the test
so that it succeeds even if there is no lynx, w3m, etc.

test/mhfixmsg/test-mhfixmsg
uip/mhfixmsg.c

index 9f9f69b69f6c265e2cafb8adbda1dbf790b064f2..3bffa9a8be06e75e3189adb01c4092c3873be658 100755 (executable)
@@ -666,9 +666,14 @@ d><td align=3D"right"><font face=3D"Arial, Helvetica, sans-serif" color=3D"=
 </html>
 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" <<EOF
 From: Test <test@example.com>
index 1c3a632ee366456d7dedd0ce3a36999cd423e41f..2714024da18810b1b8847cac94ad5eeb7407f0d9 100644 (file)
@@ -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");
+                    }
                 }
             }