]> diplodocus.org Git - nmh/blobdiff - uip/mhpath.c
vector.c: Move interface to own file.
[nmh] / uip / mhpath.c
index 16425ac182a1490f9081e5615cda5b662ea63fbb..95a9d7555146e2b69b1fb9f75afba64bca8b6e71 100644 (file)
@@ -5,9 +5,14 @@
  * complete copyright information.
  */
 
  * complete copyright information.
  */
 
-#include <h/mh.h>
-#include <h/utils.h>
-#include "../sbr/m_maildir.h"
+#include "h/mh.h"
+#include "sbr/path.h"
+#include "sbr/print_version.h"
+#include "sbr/print_help.h"
+#include "sbr/error.h"
+#include "h/done.h"
+#include "h/utils.h"
+#include "sbr/m_maildir.h"
 
 #define MHPATH_SWITCHES \
     X("version", 0, VERSIONSW) \
 
 #define MHPATH_SWITCHES \
     X("version", 0, VERSIONSW) \
@@ -31,7 +36,7 @@ main(int argc, char **argv)
     struct msgs_array msgs = { 0, 0, NULL };
     struct msgs *mp;
 
     struct msgs_array msgs = { 0, 0, NULL };
     struct msgs *mp;
 
-    if (nmh_init(argv[0], 2)) { return 1; }
+    if (nmh_init(argv[0], true, false)) { return 1; }
 
     arguments = getarguments (invo_name, argc, argv, 1);
     argp = arguments;
 
     arguments = getarguments (invo_name, argc, argv, 1);
     argp = arguments;
@@ -46,7 +51,7 @@ main(int argc, char **argv)
                    ambigsw (cp, switches);
                    done (1);
                case UNKWNSW: 
                    ambigsw (cp, switches);
                    done (1);
                case UNKWNSW: 
-                   adios (NULL, "-%s unknown", cp);
+                   die("-%s unknown", cp);
 
                case HELPSW: 
                    snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]",
 
                case HELPSW: 
                    snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]",
@@ -60,9 +65,8 @@ main(int argc, char **argv)
        }
        if (*cp == '+' || *cp == '@') {
            if (folder)
        }
        if (*cp == '+' || *cp == '@') {
            if (folder)
-               adios (NULL, "only one folder at a time!");
-           else
-               folder = pluspath (cp);
+               die("only one folder at a time!");
+            folder = pluspath (cp);
        } else
                app_msgarg(&msgs, cp);
     }
        } else
                app_msgarg(&msgs, cp);
     }
@@ -85,7 +89,7 @@ main(int argc, char **argv)
 
     /* read folder and create message structure */
     if (!(mp = folder_read (folder, 1)))
 
     /* read folder and create message structure */
     if (!(mp = folder_read (folder, 1)))
-       adios (NULL, "unable to read folder %s", folder);
+       die("unable to read folder %s", folder);
 
     /*
      * We need to make sure there is message status space
 
     /*
      * We need to make sure there is message status space
@@ -95,10 +99,10 @@ main(int argc, char **argv)
      */
     if (mp->hghmsg >= mp->hghoff) {
        if (!(mp = folder_realloc (mp, 1, mp->hghmsg + 10)))
      */
     if (mp->hghmsg >= mp->hghoff) {
        if (!(mp = folder_realloc (mp, 1, mp->hghmsg + 10)))
-           adios (NULL, "unable to allocate folder storage");
+           die("unable to allocate folder storage");
     } else if (mp->lowoff > 1) {
        if (!(mp = folder_realloc (mp, 1, mp->hghoff)))
     } else if (mp->lowoff > 1) {
        if (!(mp = folder_realloc (mp, 1, mp->hghoff)))
-           adios (NULL, "unable to allocate folder storage");
+           die("unable to allocate folder storage");
     }
 
     mp->msgflags |= ALLOW_NEW; /* allow the "new" sequence */
     }
 
     mp->msgflags |= ALLOW_NEW; /* allow the "new" sequence */