]> diplodocus.org Git - nmh/blobdiff - uip/mhshow.c
Removed potential buffer overflow from ruserpass(). It had been
[nmh] / uip / mhshow.c
index f289d471d18d57dee2bd67e92d12e76c3af0afcd..eb6ea16b89e93ff1b617edb0ef316309c8e681a2 100644 (file)
@@ -31,6 +31,8 @@
     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) \
@@ -56,9 +58,6 @@ DEFINE_SWITCH_ARRAY(MHSHOW, switches);
 #undef X
 
 
-/* mhparse.c */
-extern char *tmp;      /* directory to place temp files */
-
 /* mhcachesbr.c */
 extern int rcachesw;
 extern int wcachesw;
@@ -69,7 +68,7 @@ extern char *cache_private;
 extern int pausesw;
 extern int serialsw;
 extern char *progsw;
-extern int nolist;
+extern char *display_charset;
 extern int nomore;     /* flags for moreproc/header display */
 extern char *formsw;
 
@@ -118,15 +117,9 @@ main (int argc, char **argv)
     CT ct, *ctp;
     FILE *fp;
 
-    done=freects_done;
-
-#ifdef LOCALE
-    setlocale(LC_ALL, "");
-#endif
-    invo_name = r1bindex (argv[0], '/');
+    if (nmh_init(argv[0], 1)) { return 1; }
 
-    /* read user profile/context */
-    context_read();
+    done=freects_done;
 
     arguments = getarguments (invo_name, argc, argv, 1);
     argp = arguments;
@@ -210,6 +203,16 @@ 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]);
@@ -294,16 +297,6 @@ do_cache:
        cache_private = ".cache";
     cache_private = getcpy (m_maildir (cache_private));
 
-    /*
-     * Check for storage directory.  If specified,
-     * then store temporary files there.  Else we
-     * store them in standard nmh directory.
-     */
-    if ((cp = context_find (nmhstorage)) && *cp)
-       tmp = concat (cp, "/", invo_name, NULL);
-    else
-       tmp = add (m_maildir (invo_name), NULL);
-
     if (!context_find ("path"))
        free (path ("./", TFOLDER));