/*
- * rmf.c -- remove a folder
- *
- * This code is Copyright (c) 2002, by the authors of nmh. See the
- * COPYRIGHT file in the root directory of the nmh distribution for
- * complete copyright information.
- */
+** rmf.c -- remove a folder
+**
+** This code is Copyright (c) 2002, by the authors of nmh. See the
+** COPYRIGHT file in the root directory of the nmh distribution for
+** complete copyright information.
+*/
#include <h/mh.h>
};
/*
- * static prototypes
- */
+** static prototypes
+*/
static int rmf(char *);
static void rma (char *);
adios (NULL, "-%s unknown", cp);
case HELPSW:
- snprintf (buf, sizeof(buf), "%s [+folder] [switches]",
- invo_name);
+ snprintf (buf, sizeof(buf), "%s [+folder] [switches]", invo_name);
print_help (buf, switches, 1);
done (1);
case VERSIONSW:
else
folder = pluspath (cp);
} else {
- adios (NULL, "usage: %s [+folder] [switches]", invo_name);
+ adios (NULL, "usage: %s [+folder] [switches]",
+ invo_name);
}
}
interactive = defolder;
if (strchr (folder, '/') && (*folder != '/') && (*folder != '.')) {
- for (cp = copy (folder, newfolder); cp > newfolder && *cp != '/'; cp--)
+ for (cp = copy (folder, newfolder);
+ cp > newfolder && *cp != '/'; cp--)
continue;
if (cp > newfolder)
*cp = '\0';
char *cfolder = context_find(pfolder);
if (cfolder && strcmp (cfolder, newfolder)) {
printf ("[+%s now current]\n", newfolder);
- context_replace (pfolder, newfolder); /* update current folder */
+ /* update current folder */
+ context_replace (pfolder, newfolder);
}
}
context_save (); /* save the context file */
switch (i = chdir (maildir = m_maildir (folder))) {
case OK:
- if (access (".", W_OK) != NOTOK && access ("..", W_OK) != NOTOK)
+ if (access (".", W_OK) != NOTOK &&
+ access ("..", W_OK) != NOTOK)
break; /* fall otherwise */
case NOTOK:
printf ("[+%s de-referenced]\n", folder);
return OK;
}
- advise (NULL, "you have no profile entry for the %s folder +%s",
- i == NOTOK ? "unreadable" : "read-only", folder);
+ advise (NULL, "you have no profile entry for the %s folder +%s", i == NOTOK ? "unreadable" : "read-only", folder);
return NOTOK;
}
others = 0;
/*
- * Run the external delete hook program.
- */
+ ** Run the external delete hook program.
+ */
(void)ext_hook("del-hook", maildir, (char *)0);
switch (dp->d_name[0]) {
case '.':
if (strcmp (dp->d_name, ".") == 0
- || strcmp (dp->d_name, "..") == 0)
+ || strcmp (dp->d_name, "..")
+ == 0)
continue; /* else fall */
case ',':
if (m_atoi (dp->d_name))
break;
if (strcmp (dp->d_name, altmsglink) == 0
- || strncmp (dp->d_name, backup_prefix, j) == 0)
+ || strncmp (dp->d_name,
+ backup_prefix, j) == 0)
break;
admonish (NULL, "file \"%s/%s\" not deleted",
closedir (dd);
/*
- * Remove any relevant private sequences
- * or attributes from context file.
- */
+ ** Remove any relevant private sequences
+ ** or attributes from context file.
+ */
rma (folder);
chdir ("..");
/*
- * Remove all the (private) sequence information for
- * this folder from the profile/context list.
- */
+** Remove all the (private) sequence information for
+** this folder from the profile/context list.
+*/
static void
rma (char *folder)
plen = strlen (cp = m_mailpath (folder)) + 1;
/*
- * Search context list for keys that look like
- * "atr-something-folderpath", and remove them.
- */
+ ** Search context list for keys that look like
+ ** "atr-something-folderpath", and remove them.
+ */
for (np = m_defs, pp = NULL; np; np = np->n_next) {
if (ssequal ("atr-", np->n_name)
&& (j = strlen (np->n_name) - plen) > alen
&& *(np->n_name + j) == '-'
&& strcmp (cp, np->n_name + j + 1) == 0) {
if (!np->n_context)
- admonish (NULL, "bug: context_del(key=\"%s\")", np->n_name);
+ admonish (NULL, "bug: context_del(key=\"%s\")",
+ np->n_name);
if (pp) {
pp->n_next = np->n_next;
np = pp;