]> diplodocus.org Git - nmh/blobdiff - uip/flist.c
inc/test-eom-align: Fix MMDF-mbox `B' size calculation.
[nmh] / uip / flist.c
index 65ddf458168820c164e0fc1f4e49c4dbbb71d320..e3c84a43ec6f44f26f2eae9b4d8c353169df0433 100644 (file)
@@ -15,7 +15,8 @@
 
 #include <h/mh.h>
 #include <h/utils.h>
 
 #include <h/mh.h>
 #include <h/utils.h>
-#include "../sbr/m_maildir.h"
+#include "h/done.h"
+#include "sbr/m_maildir.h"
 
 /*
  * We allocate space to record the names of folders
 
 /*
  * We allocate space to record the names of folders
@@ -73,11 +74,11 @@ static int maxfolders;
 /* info on sequences to search for */
 static svector_t sequencesToDo;
 
 /* info on sequences to search for */
 static svector_t sequencesToDo;
 
-static int all        = FALSE;  /* scan all folders in top level?           */
-static int alphaOrder = FALSE; /* want alphabetical order only             */
-static int recurse    = FALSE; /* show nested folders?                     */
-static int showzero   = TRUE;  /* show folders even if no messages in seq? */
-static int Total      = TRUE;  /* display info on number of messages in    *
+static bool all;                /* scan all folders in top level? */
+static bool alphaOrder;         /* want alphabetical order only */
+static bool recurse;            /* show nested folders? */
+static bool showzero = true;    /* show folders even if no messages in seq? */
+static bool Total = true;       /* display info on number of messages in
                                 * sequence found, and total num messages   */
 
 static char curfolder[BUFSIZ]; /* name of the current folder */
                                 * sequence found, and total num messages   */
 
 static char curfolder[BUFSIZ]; /* name of the current folder */
@@ -126,7 +127,7 @@ main(int argc, char **argv)
     /* allocate the initial space to record the folder names */
     numfolders = 0;
     maxfolders = MAXFOLDERS;
     /* 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);
 
     /* no sequences yet */
     sequencesToDo = svector_create (0);
@@ -158,41 +159,41 @@ main(int argc, char **argv)
                break;
 
            case ALLSW:
                break;
 
            case ALLSW:
-               all = TRUE;
+               all = true;
                break;
            case NOALLSW:
                break;
            case NOALLSW:
-               all = FALSE;
+               all = false;
                break;
 
            case SHOWZERO:
                break;
 
            case SHOWZERO:
-               showzero = TRUE;
+               showzero = true;
                break;
            case NOSHOWZERO:
                break;
            case NOSHOWZERO:
-               showzero = FALSE;
+               showzero = false;
                break;
 
            case ALPHASW:
                break;
 
            case ALPHASW:
-               alphaOrder = TRUE;
+               alphaOrder = true;
                break;
            case NOALPHASW:
                break;
            case NOALPHASW:
-               alphaOrder = FALSE;
+               alphaOrder = false;
                break;
 
            case NOFASTSW:
            case TOTALSW:
                break;
 
            case NOFASTSW:
            case TOTALSW:
-               Total = TRUE;
+               Total = true;
                break;
 
            case FASTSW:
            case NOTOTALSW:
                break;
 
            case FASTSW:
            case NOTOTALSW:
-               Total = FALSE;
+               Total = false;
                break;
 
            case RECURSE:
                break;
 
            case RECURSE:
-               recurse = TRUE;
+               recurse = true;
                break;
            case NORECURSE:
                break;
            case NORECURSE:
-               recurse = FALSE;
+               recurse = false;
                break;
            }
        } else {
                break;
            }
        } else {
@@ -202,7 +203,7 @@ main(int argc, char **argv)
             */
            if (numfolders >= maxfolders) {
                maxfolders += MAXFOLDERS;
             */
            if (numfolders >= maxfolders) {
                maxfolders += MAXFOLDERS;
-               foldersToDo = (char **) mh_xrealloc (foldersToDo,
+               foldersToDo = mh_xrealloc (foldersToDo,
                    (size_t) (maxfolders * sizeof(*foldersToDo)));
            }
            if (*cp == '+' || *cp == '@') {
                    (size_t) (maxfolders * sizeof(*foldersToDo)));
            }
            if (*cp == '+' || *cp == '@') {
@@ -274,7 +275,7 @@ GetFolderOrder(void)
            AllocFolders(&orders, &nOrdersAlloced, nOrders + 1);
            o = &orders[nOrders++];
            o->priority = priority++;
            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
            strncpy(o->name, s, p - s);
            o->name[p - s] = 0;
        } else
@@ -410,7 +411,7 @@ BuildFolderListRecurse(char *dirName, struct stat *s, int searchdepth)
        /* Check to see if the name of the file is a number
         * if it is, we assume it's a mail file and skip it
         */
        /* Check to see if the name of the file is a number
         * if it is, we assume it's a mail file and skip it
         */
-       for (n = dp->d_name; *n && isdigit((unsigned char) *n); n++);
+       for (n = dp->d_name; isdigit((unsigned char)*n); n++);
        if (!*n)
            continue;
        strncpy (name, base, sizeof(name) - 2);
        if (!*n)
            continue;
        strncpy (name, base, sizeof(name) - 2);
@@ -614,10 +615,10 @@ AllocFolders(struct Folder **f, int *nfa, int n)
        return;
     if (*f == NULL) {
        *nfa = 10;
        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;
     } else {
        *nfa *= 2;
-       *f = (struct Folder *) mh_xrealloc (*f, *nfa * (sizeof(struct Folder)));
+       *f = mh_xrealloc (*f, *nfa * (sizeof(struct Folder)));
     }
 }
 
     }
 }