]> diplodocus.org Git - nmh/blobdiff - uip/flist.c
Don't `else' after return. Simplify control flow.
[nmh] / uip / flist.c
index cea1ca7c3c1e940cf6faee2ac92c179264567df6..84f6ba29427ecbd3619e6dde96343683a9aa3311 100644 (file)
@@ -17,9 +17,6 @@
 #include <h/mh.h>
 #include <h/utils.h>
 
 #include <h/mh.h>
 #include <h/utils.h>
 
-#define FALSE   0
-#define TRUE    1
-
 /*
  * We allocate space to record the names of folders
  * (foldersToDo array), this number of elements at a time.
 /*
  * We allocate space to record the names of folders
  * (foldersToDo array), this number of elements at a time.
@@ -115,18 +112,13 @@ main(int argc, char **argv)
     char **arguments;
     char buf[BUFSIZ];
 
     char **arguments;
     char buf[BUFSIZ];
 
-    setlocale(LC_ALL, "");
-    invo_name = r1bindex(argv[0], '/');
-
-    /* read user profile/context */
-    context_read();
+    if (nmh_init(argv[0], 1)) { return 1; }
 
     /*
      * If program was invoked with name ending
      * in `s', then add switch `-all'.
      */
 
     /*
      * If program was invoked with name ending
      * in `s', then add switch `-all'.
      */
-    if (argv[0][strlen (argv[0]) - 1] == 's')
-       all = TRUE;
+    all = EndsWithC(argv[0], 's');
 
     arguments = getarguments (invo_name, argc, argv, 1);
     argp = arguments;
 
     arguments = getarguments (invo_name, argc, argv, 1);
     argp = arguments;
@@ -239,7 +231,7 @@ main(int argc, char **argv)
        if ((cp = context_find(usequence)) && *cp) {
            char **ap, *dp;
 
        if ((cp = context_find(usequence)) && *cp) {
            char **ap, *dp;
 
-           dp = getcpy(cp);
+           dp = mh_xstrdup(cp);
            ap = brkstring (dp, " ", "\n");
            for (; ap && *ap; ap++)
                svector_push_back (sequencesToDo, *ap);
            ap = brkstring (dp, " ", "\n");
            for (; ap && *ap; ap++)
                svector_push_back (sequencesToDo, *ap);
@@ -461,7 +453,7 @@ AddFolder(char *name, int force)
        /* Oops, error occurred.  Record it and continue. */
        AllocFolders(&folders, &nFoldersAlloced, nFolders + 1);
        f = &folders[nFolders++];
        /* Oops, error occurred.  Record it and continue. */
        AllocFolders(&folders, &nFoldersAlloced, nFolders + 1);
        f = &folders[nFolders++];
-       f->name = getcpy(name);
+       f->name = mh_xstrdup(name);
        f->error = 1;
        f->priority = AssignPriority(f->name);
        return 0;
        f->error = 1;
        f->priority = AssignPriority(f->name);
        return 0;
@@ -497,7 +489,7 @@ AddFolder(char *name, int force)
        /* save general folder information */
        AllocFolders(&folders, &nFoldersAlloced, nFolders + 1);
        f = &folders[nFolders++];
        /* save general folder information */
        AllocFolders(&folders, &nFoldersAlloced, nFolders + 1);
        f = &folders[nFolders++];
-       f->name = getcpy(name);
+       f->name = mh_xstrdup(name);
        f->nMsgs = mp->nummsg;
        f->nSeq = ivector_create (0);
        f->private = ivector_create (0);
        f->nMsgs = mp->nummsg;
        f->nSeq = ivector_create (0);
        f->private = ivector_create (0);
@@ -672,7 +664,7 @@ do_readonly_folders (void)
 {
     int atrlen;
     char atrcur[BUFSIZ];
 {
     int atrlen;
     char atrcur[BUFSIZ];
-    register struct node *np;
+    struct node *np;
 
     snprintf (atrcur, sizeof(atrcur), "atr-%s-", current);
     atrlen = strlen (atrcur);
 
     snprintf (atrcur, sizeof(atrcur), "atr-%s-", current);
     atrlen = strlen (atrcur);