]> diplodocus.org Git - nmh/commitdiff
Removed the -[no]textcharset switches that were added to mhshow(1)
authorDavid Levine <levinedl@acm.org>
Tue, 11 Feb 2014 05:17:28 +0000 (23:17 -0600)
committerDavid Levine <levinedl@acm.org>
Tue, 11 Feb 2014 05:17:28 +0000 (23:17 -0600)
in commit 721b0395fb2fceac4e66fed1009ed2f17fd5351f.  They weren't
needed.  So the net effect is that, if built with iconv, mhshow
will attempt to convert text/plain content to match the user's locale.

docs/pending-release-notes
man/mhshow.man
test/mhshow/test-textcharset
uip/mhshow.c
uip/mhshowsbr.c

index dc764f1eac9da3f80c61b86b72aad9ab05a863d5..759109a4ed5d29892daabb3c83da9189a24c2988 100644 (file)
@@ -74,10 +74,9 @@ NEW FEATURES
   Nmh-Attachment).
 - The default Content-Transfer-Encoding for text parts is now 8bit.
 - mhbuild(1) now supports a selectable Content-Transfer-Encoding
-- Added -[no]textcharset switches to mhshow(1).  These only apply if
-  nmh was configured with iconv(3) support.  If -textcharset is not
-  used, mhshow will convert, if necessary, the charset of text/plain
-  content to match the user's locale setting.
+- If nmh was configured with iconv(3) support, mhshow will convert, if
+  necessary, the charset of text/plain content to match the user's
+  locale setting.
 
 -----------------
 OBSOLETE FEATURES
index baafe7e541a43c3602a7f1ff62ea9e261e78cc51..7cb76cf11b780391f8e8c854e8fe3ffde60daa20 100644 (file)
@@ -22,9 +22,6 @@ mhshow \- display MIME messages
 .RB [ \-pause " | " \-nopause ]
 .RB [ \-form
 .IR formfile ]
-.RB [ \-textcharset
-.I charset
-.RB "| " \-notextcharset ]
 .RB [ \-rcache
 .IR policy ]
 .RB [ \-wcache
@@ -328,11 +325,9 @@ If
 .B mhshow
 was built with
 .IR iconv (3),
-then all text/plain parts of the message(s) will be displayed
-using the character set of the current locale.  This character
-set can be overridden with the
-.B \-textcharset
-switch.  To convert text parts other than text/plain, or if
+then all text/plain parts of the message(s) will be displayed using
+the character set of the current locale.  To convert text parts other
+than text/plain, or if
 .B mhshow
 was not built with
 .IR iconv ,
@@ -624,7 +619,6 @@ is checked.
 .RB ` \-nocheck '
 .RB ` \-form\ mhl.headers '
 .RB ` \-pause '
-.RB ` \-notextcharset '
 .RB ` \-rcache\ ask '
 .RB ` \-noserialonly '
 .RB ` \-wcache\ ask '
index c1a69d101d7b3a3ba6f04d213c755de71239d8b0..c55f95b938678ce8590a4eacae2efc0c344fa9e9 100755 (executable)
@@ -20,6 +20,8 @@ if test "$ICONV_ENABLED" -eq 0; then
   test_skip 'test-textcharset requires that nmh have been built with iconv'
 fi
 
+LC_ALL=en_US.UTF-8; export LC_ALL
+
 expected="$MH_TEST_DIR"/$$.expected
 actual="$MH_TEST_DIR"/$$.actual
 
@@ -36,22 +38,6 @@ Date: Sun, 18 Dec 2005 00:52:39 +0100
 4 =F7 2 =3D 2
 EOF
 
-# Check -notextcharset.
-cat >"$expected" <<EOF
-Date:    Sun, 18 Dec 2005 00:52:39 +0100
-To:      bar@example.edu
-From:    foo@example.edu
-Subject: test display with charset conversion
-
-MIME-Version: 1.0
-
-EOF
-
-LC_ALL=C; export LC_ALL
-run_prog mhshow -textcharset UTF-8 -notextcharset -nopause last >"$actual" 2>&1
-check "$expected" "$actual"
-
-# Check -textcharset.
 cat >"$expected" <<EOF
 Date:    Sun, 18 Dec 2005 00:52:39 +0100
 To:      bar@example.edu
@@ -64,11 +50,6 @@ part       text/plain                  10
 4 รท 2 = 2
 EOF
 
-run_prog mhshow -textcharset UTF-8 -nopause last >"$actual" 2>&1
-check "$expected" "$actual" 'keep first'
-
-# Check use of user's locale.
-LC_ALL=en_US.UTF-8; export LC_ALL
 run_prog mhshow -nopause last >"$actual" 2>&1
 check "$expected" "$actual"
 
index eb6ea16b89e93ff1b617edb0ef316309c8e681a2..f83236b7433e1f063ef77ce29aa6efb6121c86b1 100644 (file)
@@ -31,8 +31,6 @@
     X("form formfile", 0, FORMSW) \
     X("part number", 0, PARTSW) \
     X("type content", 0, TYPESW) \
-    X("textcharset", 0, TEXTCHARSETSW) \
-    X("notextcharset", 0, NTEXTCHARSETSW) \
     X("rcache policy", 0, RCACHESW) \
     X("wcache policy", 0, WCACHESW) \
     X("version", 0, VERSIONSW) \
@@ -68,7 +66,6 @@ extern char *cache_private;
 extern int pausesw;
 extern int serialsw;
 extern char *progsw;
-extern char *display_charset;
 extern int nomore;     /* flags for moreproc/header display */
 extern char *formsw;
 
@@ -203,16 +200,6 @@ do_cache:
                types[ntype++] = cp;
                continue;
 
-           case TEXTCHARSETSW:
-               if (!(cp = *argp++) || *cp == '-')
-                   adios (NULL, "missing argument to %s", argp[-2]);
-               display_charset = cp;
-               continue;
-
-            case NTEXTCHARSETSW:
-                display_charset = NULL;
-                continue;
-
            case FILESW:
                if (!(cp = *argp++) || (*cp == '-' && cp[1]))
                    adios (NULL, "missing argument to %s", argp[-2]);
index fa449772c09d97140e6459f7c3338334f1dcc885..4bab75cafeaf164ec1802d4672cb060877aaefe5 100644 (file)
@@ -28,7 +28,6 @@ int serialsw = 0;
 int nolist   = 0;
 
 char *progsw = NULL;
-char *display_charset = NULL;
 
 /* flags for moreproc/header display */
 int nomore   = 0;
@@ -323,7 +322,10 @@ show_content_aux (CT ct, int serial, int alternate, char *cp, char *cracked)
            some code rearrangement.  And to make this really ugly,
            only do it in mhshow, not mhfixmsg, mhn, or mhstore. */
         if (convert_content_charset (ct, &file) != OK) {
-            return NOTOK;
+            admonish (NULL, "unable to convert character set%s to %s",
+                      ct->c_partno  ?  "of part "  :  "",
+                      ct->c_partno  ?  ct->c_partno  :  "",
+                      content_charset (ct));
         }
     }
 
@@ -1232,26 +1234,16 @@ convert_charset (CT ct, char *dest_charset, int *message_mods) {
 
 static int
 convert_content_charset (CT ct, char **file) {
-    /* Convert character set if needed and if built with iconv. */
 #ifdef HAVE_ICONV
-    if (display_charset == NULL) {
-        /* The user did not specify a display charset, so use
-           current setting and see if the content will need to be
-           converted. */
-        char *charset = content_charset (ct);
-
-        if (! check_charset (charset, strlen (charset))) {
-            int unused = 0;
-            if (convert_charset (ct, get_charset (), &unused) == 0) {
-                *file = ct->c_cefile.ce_file;
-            } else {
-                return NOTOK;
-            }
-        }
-    } else {
-        /* The user requested display with a specific charset. */
+    /* Using current locale, see if the content needs to be converted. */
+
+    /* content_charset() cannot return NULL. */
+    char *charset = content_charset (ct);
+
+    if (! check_charset (charset, strlen (charset))) {
         int unused = 0;
-        if (convert_charset (ct, display_charset, &unused) == 0) {
+
+        if (convert_charset (ct, get_charset (), &unused) == 0) {
             *file = ct->c_cefile.ce_file;
         } else {
             return NOTOK;