]> diplodocus.org Git - nmh/blobdiff - uip/flist.c
Display the command when reporting timing.
[nmh] / uip / flist.c
index f40f010dee9e7b8afd42b35050e27a17683055df..2372ffc05bb91e1b783578f2834da3827b7207d6 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <h/mh.h>
 #include <h/utils.h>
+#include "h/done.h"
 #include "sbr/m_maildir.h"
 
 /*
@@ -112,7 +113,7 @@ main(int argc, char **argv)
     char **arguments;
     char buf[BUFSIZ];
 
-    if (nmh_init(argv[0], 1)) { return 1; }
+    if (nmh_init(argv[0], true, true)) { return 1; }
 
     /*
      * If program was invoked with name ending
@@ -126,7 +127,7 @@ main(int argc, char **argv)
     /* allocate the initial space to record the folder names */
     numfolders = 0;
     maxfolders = MAXFOLDERS;
-    foldersToDo = (char **) mh_xmalloc ((size_t) (maxfolders * sizeof(*foldersToDo)));
+    foldersToDo = mh_xmalloc ((size_t) (maxfolders * sizeof(*foldersToDo)));
 
     /* no sequences yet */
     sequencesToDo = svector_create (0);
@@ -139,7 +140,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 [+folder1 [+folder2 ...]][switches]",
@@ -152,7 +153,7 @@ main(int argc, char **argv)
 
            case SEQSW:
                if (!(cp = *argp++) || *cp == '-')
-                   adios (NULL, "missing argument to %s", argp[-2]);
+                   die("missing argument to %s", argp[-2]);
 
                svector_push_back (sequencesToDo, cp);
                break;
@@ -202,7 +203,7 @@ main(int argc, char **argv)
             */
            if (numfolders >= maxfolders) {
                maxfolders += MAXFOLDERS;
-               foldersToDo = (char **) mh_xrealloc (foldersToDo,
+               foldersToDo = mh_xrealloc (foldersToDo,
                    (size_t) (maxfolders * sizeof(*foldersToDo)));
            }
            if (*cp == '+' || *cp == '@') {
@@ -236,7 +237,7 @@ main(int argc, char **argv)
            for (; ap && *ap; ap++)
                svector_push_back (sequencesToDo, *ap);
        } else {
-           adios (NULL, "no sequence specified or %s profile entry found", usequence);
+           die("no sequence specified or %s profile entry found", usequence);
        }
     }
 
@@ -274,7 +275,7 @@ GetFolderOrder(void)
            AllocFolders(&orders, &nOrdersAlloced, nOrders + 1);
            o = &orders[nOrders++];
            o->priority = priority++;
-           o->name = (char *) mh_xmalloc(p - s + 1);
+           o->name = mh_xmalloc(p - s + 1);
            strncpy(o->name, s, p - s);
            o->name[p - s] = 0;
        } else
@@ -442,7 +443,8 @@ static int
 AddFolder(char *name, int force)
 {
     unsigned int i;
-    int msgnum, nonzero;
+    int msgnum;
+    bool nonzero;
     ivector_t seqnum = ivector_create (0), nSeq = ivector_create (0);
     struct Folder *f;
     struct msgs *mp;
@@ -477,10 +479,10 @@ AddFolder(char *name, int force)
     }
 
     /* Check if any of the sequence checks were nonzero */
-    nonzero = 0;
+    nonzero = false;
     for (i = 0; i < svector_size (sequencesToDo); i++) {
        if (ivector_at (nSeq, i) > 0) {
-           nonzero = 1;
+           nonzero = true;
            break;
        }
     }
@@ -520,7 +522,8 @@ static void
 PrintFolders(void)
 {
     char tmpname[BUFSIZ];
-    unsigned int i, j, len, has_private = 0;
+    unsigned int i, j, len;
+    bool has_private = false;
     unsigned int maxfolderlen = 0, maxseqlen = 0;
     int maxnum = 0, maxseq = 0;
 
@@ -560,7 +563,7 @@ PrintFolders(void)
 
            /* check if this sequence is private in any of the folders */
            if (ivector_at (folders[i].private, j))
-               has_private = 1;
+               has_private = true;
        }
     }
 
@@ -614,10 +617,10 @@ AllocFolders(struct Folder **f, int *nfa, int n)
        return;
     if (*f == NULL) {
        *nfa = 10;
-       *f = (struct Folder *) mh_xmalloc (*nfa * (sizeof(struct Folder)));
+       *f = mh_xmalloc (*nfa * (sizeof(struct Folder)));
     } else {
        *nfa *= 2;
-       *f = (struct Folder *) mh_xrealloc (*f, *nfa * (sizeof(struct Folder)));
+       *f = mh_xrealloc (*f, *nfa * (sizeof(struct Folder)));
     }
 }