X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/dbdbd49d59ae5c14e66b1c148a63b8abc9d076ab..4829d096feb337a55e2b866adb19acab9617b071:/uip/new.c diff --git a/uip/new.c b/uip/new.c index d6f524a2..0dee3c37 100644 --- a/uip/new.c +++ b/uip/new.c @@ -11,10 +11,27 @@ #include -#include -#include +#include "h/mh.h" +#include "sbr/m_getfld.h" +#include "sbr/getarguments.h" +#include "sbr/concat.h" +#include "sbr/smatch.h" +#include "sbr/r1bindex.h" +#include "sbr/trimcpy.h" +#include "sbr/vfgets.h" +#include "sbr/getcpy.h" +#include "sbr/m_atoi.h" +#include "sbr/context_save.h" +#include "sbr/context_replace.h" +#include "sbr/context_find.h" +#include "sbr/brkstring.h" +#include "sbr/ambigsw.h" +#include "sbr/print_version.h" +#include "sbr/print_help.h" +#include "sbr/error.h" +#include "sbr/crawl_folders.h" #include "h/done.h" -#include +#include "h/utils.h" #include "sbr/lock_file.h" #include "sbr/m_maildir.h" @@ -56,13 +73,13 @@ count_messages(char *field) { int total = 0; int j, k; - char *cp, **ap; field = getcpy(field); /* copied from seq_read.c:seq_init */ - for (ap = brkstring (field, " ", "\n"); *ap; ap++) { - if ((cp = strchr(*ap, '-'))) + for (char *const *ap = brkstring (field, " ", "\n"); *ap; ap++) { + char *cp = strchr(*ap, '-'); + if (cp != NULL) *cp++ = '\0'; if ((j = m_atoi (*ap)) > 0) { k = cp ? m_atoi (cp) : j; @@ -118,7 +135,7 @@ get_msgnums(char *folder, char *sequences[]) seqfile = concat(m_maildir(folder), "/", mh_seq, NULL); if (seqfile == NULL) - return NULL; + return NULL; if ((fp = lkfopendata (seqfile, "r", & failed_to_lock)) == NULL) { if (failed_to_lock) @@ -436,7 +453,7 @@ doit(char *cur, char *folders, char *sequences[]) int main(int argc, char **argv) { - char **ap, *cp, **argp, **arguments; + char *cp, **argp, **arguments; char help[BUFSIZ]; char *folders = NULL; svector_t sequences = svector_create (0); @@ -510,7 +527,7 @@ main(int argc, char **argv) if (unseen == NULL || unseen[0] == '\0') { die("must specify sequences or set %s", usequence); } - for (ap = brkstring(unseen, " ", "\n"); *ap; ap++) { + for (char *const *ap = brkstring(unseen, " ", "\n"); *ap; ap++) { svector_push_back (sequences, *ap); ++i; }