X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/0a032eea07f6d77ac6ea4d5a39c9491c34358058..394a751fd883d2bbfc769fed7e254e008a2ef45e:/uip/mhpath.c?ds=sidebyside diff --git a/uip/mhpath.c b/uip/mhpath.c index 180284db..03b902f5 100644 --- a/uip/mhpath.c +++ b/uip/mhpath.c @@ -1,13 +1,31 @@ -/* - * mhpath.c -- print full pathnames of nmh messages and folders +/* mhpath.c -- print full pathnames of nmh messages and folders * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for * complete copyright information. */ -#include -#include +#include "h/mh.h" +#include "sbr/m_name.h" +#include "sbr/getarguments.h" +#include "sbr/seq_setprev.h" +#include "sbr/seq_save.h" +#include "sbr/smatch.h" +#include "sbr/m_convert.h" +#include "sbr/getfolder.h" +#include "sbr/folder_read.h" +#include "sbr/folder_realloc.h" +#include "sbr/folder_free.h" +#include "sbr/context_save.h" +#include "sbr/context_find.h" +#include "sbr/ambigsw.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) \ @@ -31,7 +49,7 @@ main(int argc, char **argv) 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; @@ -46,7 +64,7 @@ main(int argc, char **argv) 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]", @@ -60,9 +78,8 @@ main(int argc, char **argv) } 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); } @@ -85,7 +102,7 @@ main(int argc, char **argv) /* 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 @@ -95,10 +112,10 @@ main(int argc, char **argv) */ 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))) - adios (NULL, "unable to allocate folder storage"); + die("unable to allocate folder storage"); } mp->msgflags |= ALLOW_NEW; /* allow the "new" sequence */