mhshow: Add header and separation when displaying multiple messages.
[mmh] / uip / mhshowsbr.c
index 3bcf84f..13a65e4 100644 (file)
@@ -85,9 +85,16 @@ show_all_messages(CT *cts)
        for (ctp = cts; *ctp; ctp++) {
                ct = *ctp;
 
-               /* if top-level type is ok, then display message */
-               if (type_ok(ct, 1))
-                       show_single_message(ct, formsw);
+               if (!type_ok(ct, 1)) {  /* top-level type */
+                       continue;
+               }
+               if (cts[1]) {
+                       if (ctp != cts) {
+                               printf("\n\n");
+                       }
+                       printf(">>> Message %s\n\n", ct->c_file);
+               }
+               show_single_message(ct, formsw);
        }
 }
 
@@ -312,9 +319,8 @@ show_content_aux(CT ct, int alternate, char *cp, char *cracked)
 
                        case 'c':
                                /* insert charset */
-                               if (ct->c_charset) {
-                                       strncpy(bp, ct->c_charset, buflen);
-                               }
+                               strncpy(bp, ct->c_charset ? ct->c_charset :
+                                               "US-ASCII", buflen);
                                break;
 
                        case 'd':
@@ -513,7 +519,8 @@ show_text(CT ct, int alternate)
        ** if it is not a text part of a multipart/alternative
        */
        if (!alternate || ct->c_subtype == TEXT_PLAIN) {
-               if (!check_charset(ct->c_charset, strlen(ct->c_charset))) {
+               if (ct->c_charset && !check_charset(ct->c_charset,
+                               strlen(ct->c_charset))) {
                        snprintf(buffer, sizeof(buffer), "%%liconv -f '%s'",
                                        ct->c_charset);
                } else {
@@ -714,9 +721,8 @@ show_multi_aux(CT ct, int alternate, char *cp)
 
                        case 'c':
                                /* insert charset */
-                               if (ct->c_charset) {
-                                       strncpy(bp, ct->c_charset, buflen);
-                               }
+                               strncpy(bp, ct->c_charset ? ct->c_charset :
+                                               "US-ASCII", buflen);
                                break;
 
                        case 'd':