Code style: Fixed indent and comment style.
[mmh] / uip / mhparse.c
index cf264c6..af460e6 100644 (file)
@@ -963,9 +963,7 @@ InitGeneric(CT ct)
 static int
 InitText(CT ct)
 {
-       char buffer[BUFSIZ];
-       char *chset = NULL;
-       char **ap, **ep, *cp;
+       char **ap, **ep;
        struct k2v *kv;
        struct text *t;
        CI ci = &ct->c_ctinfo;
@@ -992,10 +990,11 @@ InitText(CT ct)
 
        /* check if content specified a character set */
        if (*ap) {
+               /* store its name */
+               ct->c_charset = getcpy(norm_charmap(*ep));
                /* match character set or set to CHARSET_UNKNOWN */
                for (kv = Charset; kv->kv_key; kv++) {
                        if (!mh_strcasecmp(*ep, kv->kv_key)) {
-                               chset = *ep;
                                break;
                        }
                }
@@ -1004,20 +1003,6 @@ InitText(CT ct)
                t->tx_charset = CHARSET_UNSPECIFIED;
        }
 
-       /*
-       ** If we can not handle character set natively,
-       ** then check profile for string to modify the
-       ** terminal or display method.
-       **
-       ** termproc is for mhshow, though mhlist -debug prints it, too.
-       */
-       if (chset != NULL && !check_charset(chset, strlen(chset))) {
-               snprintf(buffer, sizeof(buffer), "%s-charset-%s",
-                               invo_name, chset);
-               if ((cp = context_find(buffer)))
-                       ct->c_termproc = getcpy(cp);
-       }
-
        return OK;
 }
 
@@ -1551,7 +1536,7 @@ openBase64(CT ct, char **file)
        cp = context_find(buffer);
        if (cp == NULL || *cp == '\0') {
                snprintf(buffer, sizeof(buffer), "%s-suffix-%s", invo_name,
-                         ci->ci_type);
+                               ci->ci_type);
                cp = context_find(buffer);
        }
        if (cp != NULL && *cp != '\0') {
@@ -1767,8 +1752,10 @@ openQuoted(CT ct, char **file)
        }
        if (cp != NULL && *cp != '\0') {
                if (ce->ce_unlink) {
-                       // Temporary file already exists, so we rename to
-                       // version with extension.
+                       /*
+                       ** Temporary file already exists, so we rename to
+                       ** version with extension.
+                       */
                        char *file_org = strdup(ce->ce_file);
                        ce->ce_file = add(cp, ce->ce_file);
                        if (rename(file_org, ce->ce_file)) {
@@ -1977,7 +1964,7 @@ open7Bit(CT ct, char **file)
        cp = context_find(buffer);
        if (cp == NULL || *cp == '\0') {
                snprintf(buffer, sizeof(buffer), "%s-suffix-%s", invo_name,
-                       ci->ci_type);
+                               ci->ci_type);
                cp = context_find(buffer);
        }
        if (cp != NULL && *cp != '\0') {