]> diplodocus.org Git - nmh/blobdiff - uip/rmf.c
getcpy.c: Move interface to own file.
[nmh] / uip / rmf.c
index 724bd26fcf9590c0d613a763af23a261f5faa898..8244a21622847bfc0cdb01e49646023c8dce4e9a 100644 (file)
--- a/uip/rmf.c
+++ b/uip/rmf.c
@@ -5,9 +5,21 @@
  * complete copyright information.
  */
 
  * complete copyright information.
  */
 
-#include <h/mh.h>
+#include "h/mh.h"
+#include "sbr/m_atoi.h"
+#include "sbr/getfolder.h"
+#include "sbr/ext_hook.h"
+#include "sbr/context_save.h"
+#include "sbr/context_replace.h"
+#include "sbr/context_del.h"
+#include "sbr/context_find.h"
+#include "sbr/ambigsw.h"
+#include "sbr/path.h"
+#include "sbr/print_version.h"
+#include "sbr/print_help.h"
+#include "sbr/error.h"
 #include "h/done.h"
 #include "h/done.h"
-#include <h/utils.h>
+#include "h/utils.h"
 #include "sbr/m_maildir.h"
 #include "sbr/m_mktemp.h"
 
 #include "sbr/m_maildir.h"
 #include "sbr/m_mktemp.h"
 
@@ -35,7 +47,8 @@ static void rma (char *);
 int
 main (int argc, char **argv)
 {
 int
 main (int argc, char **argv)
 {
-    int defolder = 0, interactive = -1;
+    bool defolder = false;
+    int interactive = -1;
     char *cp, *folder = NULL, newfolder[BUFSIZ];
     char buf[BUFSIZ], **argp, **arguments;
     char *fp;
     char *cp, *folder = NULL, newfolder[BUFSIZ];
     char buf[BUFSIZ], **argp, **arguments;
     char *fp;
@@ -84,7 +97,7 @@ main (int argc, char **argv)
        free (path ("./", TFOLDER));
     if (!folder) {
        folder = getfolder (1);
        free (path ("./", TFOLDER));
     if (!folder) {
        folder = getfolder (1);
-       defolder++;
+       defolder = true;
     }
     fp = m_mailpath(folder);
     if (!strcmp(fp, pwd()))
     }
     fp = m_mailpath(folder);
     if (!strcmp(fp, pwd()))
@@ -127,7 +140,8 @@ main (int argc, char **argv)
 static int
 rmf (char *folder)
 {
 static int
 rmf (char *folder)
 {
-    int i, others;
+    int i;
+    bool others;
     char *fp;
     char *maildir;
     char cur[BUFSIZ];
     char *fp;
     char *maildir;
     char cur[BUFSIZ];
@@ -155,7 +169,7 @@ rmf (char *folder)
 
     if ((dd = opendir (".")) == NULL)
        die("unable to read folder +%s", folder);
 
     if ((dd = opendir (".")) == NULL)
        die("unable to read folder +%s", folder);
-    others = 0;
+    others = false;
 
     /*
      * Run the external delete hook program.
 
     /*
      * Run the external delete hook program.
@@ -183,12 +197,12 @@ rmf (char *folder)
 
                inform("file \"%s/%s\" not deleted, continuing...",
                        folder, dp->d_name);
 
                inform("file \"%s/%s\" not deleted, continuing...",
                        folder, dp->d_name);
-               others++;
+               others = true;
                continue;
        }
        if (m_unlink (dp->d_name) == NOTOK) {
            admonish (dp->d_name, "unable to unlink %s:", folder);
                continue;
        }
        if (m_unlink (dp->d_name) == NOTOK) {
            admonish (dp->d_name, "unable to unlink %s:", folder);
-           others++;
+           others = true;
        }
     }
 
        }
     }
 
@@ -203,7 +217,7 @@ rmf (char *folder)
     if (chdir ("..") < 0) {
        advise ("..", "chdir");
     }
     if (chdir ("..") < 0) {
        advise ("..", "chdir");
     }
-    if (others == 0 && remdir (maildir))
+    if (!others && remdir (maildir))
        return OK;
 
     inform("folder +%s not removed", folder);
        return OK;
 
     inform("folder +%s not removed", folder);