X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/b42bad5fdb20cefbafdcc2b3c90e191b4a231787..04ee0c3f6ad7e4177cc43a0c57f046013a4fbac9:/uip/new.c diff --git a/uip/new.c b/uip/new.c index 88d66ba1..af333a28 100644 --- a/uip/new.c +++ b/uip/new.c @@ -11,9 +11,13 @@ #include -#include -#include -#include +#include "h/mh.h" +#include "sbr/print_version.h" +#include "sbr/print_help.h" +#include "sbr/error.h" +#include "h/crawl_folders.h" +#include "h/done.h" +#include "h/utils.h" #include "sbr/lock_file.h" #include "sbr/m_maildir.h" @@ -175,14 +179,14 @@ get_msgnums(char *folder, char *sequences[]) continue; case BODY: - adios (NULL, "no blank lines are permitted in %s", seqfile); + die("no blank lines are permitted in %s", seqfile); break; case FILEEOF: break; default: - adios (NULL, "%s is poorly formatted", seqfile); + die("%s is poorly formatted", seqfile); } break; /* break from for loop */ } @@ -273,7 +277,7 @@ check_folders(struct node **first, struct node **last, } else { fp = fopen(folders, "r"); if (fp == NULL) { - adios(NULL, "failed to read %s", folders); + die("failed to read %s", folders); } while (vfgets(fp, &line) == OK) { len = strlen(line) - 1; @@ -370,10 +374,9 @@ doit(char *cur, char *folders, char *sequences[]) /* Found current folder in fprev mode; if we have a * previous node in the list, return it; else return * the last node. */ - if (prev == NULL) { - return last; - } - return prev; + if (prev) + return prev; + return last; } } else if (run_mode == RM_UNSEEN) { int status; @@ -444,7 +447,7 @@ main(int argc, char **argv) char *unseen; struct node *folder; - if (nmh_init(argv[0], 1)) { return 1; } + if (nmh_init(argv[0], true, true)) { return 1; } arguments = getarguments (invo_name, argc, argv, 1); argp = arguments; @@ -459,7 +462,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 (help, sizeof(help), "%s [switches] [sequences]", @@ -472,11 +475,11 @@ main(int argc, char **argv) case FOLDERSSW: if (!(folders = *argp++) || *folders == '-') - adios(NULL, "missing argument to %s", argp[-2]); + die("missing argument to %s", argp[-2]); continue; case MODESW: if (!(invo_name = *argp++) || *invo_name == '-') - adios(NULL, "missing argument to %s", argp[-2]); + die("missing argument to %s", argp[-2]); invo_name = r1bindex(invo_name, '/'); continue; } @@ -508,7 +511,7 @@ main(int argc, char **argv) /* no sequence arguments; use unseen */ unseen = context_find(usequence); if (unseen == NULL || unseen[0] == '\0') { - adios(NULL, "must specify sequences or set %s", usequence); + die("must specify sequences or set %s", usequence); } for (ap = brkstring(unseen, " ", "\n"); *ap; ap++) { svector_push_back (sequences, *ap);