X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/dbdbd49d59ae5c14e66b1c148a63b8abc9d076ab..d79618303ff42aa5e0bc2dba51fdd7b385bc97d4:/uip/rmf.c?ds=sidebyside diff --git a/uip/rmf.c b/uip/rmf.c index 724bd26f..8244a216 100644 --- a/uip/rmf.c +++ b/uip/rmf.c @@ -5,9 +5,21 @@ * complete copyright information. */ -#include +#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 +#include "h/utils.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 defolder = 0, interactive = -1; + bool defolder = false; + int interactive = -1; 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); - defolder++; + defolder = true; } fp = m_mailpath(folder); if (!strcmp(fp, pwd())) @@ -127,7 +140,8 @@ main (int argc, char **argv) static int rmf (char *folder) { - int i, others; + int i; + bool others; 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); - others = 0; + others = false; /* * Run the external delete hook program. @@ -183,12 +197,12 @@ rmf (char *folder) 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); - others++; + others = true; } } @@ -203,7 +217,7 @@ rmf (char *folder) if (chdir ("..") < 0) { advise ("..", "chdir"); } - if (others == 0 && remdir (maildir)) + if (!others && remdir (maildir)) return OK; inform("folder +%s not removed", folder);