]> diplodocus.org Git - nmh/blobdiff - uip/mhn.c
SPECS: Use `command-line interface' in one-line summary.
[nmh] / uip / mhn.c
index 6a1acc3851e2ec8494c39be7c70adadc7dfe09e9..a5b4a2746417894a551e3a1dffdc093dc8eac5e5 100644 (file)
--- a/uip/mhn.c
+++ b/uip/mhn.c
 #include <h/mime.h>
 #include <h/mhparse.h>
 #include <h/mhcachesbr.h>
+#include "h/done.h"
 #include <h/utils.h>
-#include "../sbr/m_maildir.h"
+#include "mhmisc.h"
+#include "sbr/m_maildir.h"
 #include "mhfree.h"
 #include "mhshowsbr.h"
 
@@ -75,13 +77,6 @@ DEFINE_SWITCH_ARRAY(MHN, switches);
 #undef X
 
 
-/* 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;
 
@@ -101,14 +96,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);
-
 /*
  * static prototypes
  */
@@ -132,7 +119,7 @@ main (int argc, char **argv)
 
     if (nmh_init(argv[0], 1)) { return 1; }
 
-    done=freects_done;
+    set_done(freects_done);
 
     arguments = getarguments (invo_name, argc, argv, 1);
     argp = arguments;
@@ -260,8 +247,8 @@ do_cache:
            case FORMSW:
                if (!(cp = *argp++) || *cp == '-')
                    adios (NULL, "missing argument to %s", argp[-2]);
-                mh_xfree(formsw);
-               formsw = getcpy (etcpath (cp));
+                free(formsw);
+               formsw = mh_xstrdup(etcpath(cp));
                continue;
 
            /*
@@ -311,8 +298,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);
     }
@@ -326,7 +312,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);
@@ -337,7 +323,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);
     }
 
@@ -348,7 +334,7 @@ do_cache:
     /* Check for private cache location */
     if (!(cache_private = context_find (nmhprivcache)))
        cache_private = ".cache";
-    cache_private = getcpy (m_maildir (cache_private));
+    cache_private = mh_xstrdup(m_maildir(cache_private));
 
     /*
      * Cache the current directory before we do any chdirs()'s.
@@ -385,7 +371,7 @@ do_cache:
 
        execvp ("mhbuild", vec);
        fprintf (stderr, "unable to exec ");
-       _exit (-1);
+       _exit(1);
     }
 
     /*
@@ -412,7 +398,7 @@ do_cache:
 
        execvp ("mhbuild", vec);
        fprintf (stderr, "unable to exec ");
-       _exit (-1);
+       _exit(1);
     }
 
     if (file && msgs.size)