]> diplodocus.org Git - nmh/blobdiff - uip/mhn.c
lock_file.c: close(2) file descriptor on failure, avoiding leak.
[nmh] / uip / mhn.c
index 335d4b29423241a17c24d070e8783ae75c0ed509..4a3b33a769f117d2881753fcc28e04ab0c9dc307 100644 (file)
--- a/uip/mhn.c
+++ b/uip/mhn.c
 #include <h/md5.h>
 #include <h/mts.h>
 #include <h/tws.h>
+#include <h/fmt_scan.h>
 #include <h/mime.h>
 #include <h/mhparse.h>
 #include <h/mhcachesbr.h>
 #include <h/utils.h>
+#include "mhmisc.h"
+#include "sbr/m_maildir.h"
 #include "mhfree.h"
+#include "mhshowsbr.h"
 
 #define MHN_SWITCHES \
     X("auto", 0, AUTOSW) \
@@ -72,25 +76,6 @@ DEFINE_SWITCH_ARRAY(MHN, switches);
 #undef X
 
 
-/* mhcachesbr.c */
-extern int rcachesw;
-extern int wcachesw;
-extern char *cache_public;
-extern char *cache_private;
-
-/* mhshowsbr.c */
-extern char *progsw;
-extern int nolist;
-extern int nomore;     /* flags for moreproc/header display */
-extern char *formsw;
-
-/* mhmisc.c */
-extern int npart;
-extern int ntype;
-extern char *parts[NPARTS + 1];
-extern char *types[NTYPES + 1];
-extern int userrs;
-
 int debugsw = 0;
 int verbosw = 0;
 
@@ -110,17 +95,6 @@ static int storesw = 0;
 
 #define        quitser pipeser
 
-/* mhparse.c */
-CT parse_mime (char *);
-
-/* mhmisc.c */
-int part_ok (CT);
-int type_ok (CT, int);
-void flush_errors (void);
-
-/* mhcachesbr.c */
-void cache_all_messages (CT *);
-
 /*
  * static prototypes
  */
@@ -192,9 +166,9 @@ main (int argc, char **argv)
 do_cache:
                if (!(cp = *argp++) || *cp == '-')
                    adios (NULL, "missing argument to %s", argp[-2]);
-               switch (*icachesw = smatch (cp, caches)) {
+               switch (*icachesw = smatch (cp, cache_policy)) {
                case AMBIGSW:
-                   ambigsw (cp, caches);
+                   ambigsw (cp, cache_policy);
                    done (1);
                case UNKWNSW:
                    adios (NULL, "%s unknown", cp);
@@ -272,7 +246,7 @@ do_cache:
            case FORMSW:
                if (!(cp = *argp++) || *cp == '-')
                    adios (NULL, "missing argument to %s", argp[-2]);
-                mh_xfree(formsw);
+                free(formsw);
                formsw = getcpy (etcpath (cp));
                continue;
 
@@ -323,8 +297,7 @@ do_cache:
        if (*cp == '+' || *cp == '@') {
            if (folder)
                adios (NULL, "only one folder at a time!");
-           else
-               folder = pluspath (cp);
+            folder = pluspath (cp);
        } else
                app_msgarg(&msgs, cp);
     }
@@ -338,7 +311,7 @@ do_cache:
      */
     if ((cp = getenv ("MHN"))) {
        if ((fp = fopen (cp, "r"))) {
-           readconfig ((struct node **) 0, fp, cp, 0);
+           readconfig(NULL, fp, cp, 0);
            fclose (fp);
        } else {
            admonish ("", "unable to read $MHN profile (%s)", cp);
@@ -349,7 +322,7 @@ do_cache:
      * Read the standard profile setup
      */
     if ((fp = fopen (cp = etcpath ("mhn.defaults"), "r"))) {
-       readconfig ((struct node **) 0, fp, cp, 0);
+       readconfig(NULL, fp, cp, 0);
        fclose (fp);
     }