X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Frmf.c;h=050817bf0ae64781fb0bbcc2a75be11adfef77db;hp=f3c335e0acea4978db3465b4937fd243f1d12024;hb=ced6090a330d3d83d0bce709f756aa3d7d65fea4;hpb=337338b404931f06f0db2119c9e145e8ca5a9860 diff --git a/uip/rmf.c b/uip/rmf.c index f3c335e..050817b 100644 --- a/uip/rmf.c +++ b/uip/rmf.c @@ -1,10 +1,10 @@ /* - * 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 @@ -21,8 +21,8 @@ static struct swit switches[] = { }; /* - * static prototypes - */ +** static prototypes +*/ static int rmf(char *); static void rma (char *); @@ -55,8 +55,7 @@ main (int argc, char **argv) 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: @@ -77,7 +76,8 @@ main (int argc, char **argv) else folder = pluspath (cp); } else { - adios (NULL, "usage: %s [+folder] [switches]", invo_name); + adios (NULL, "usage: %s [+folder] [switches]", + invo_name); } } @@ -94,7 +94,8 @@ main (int argc, char **argv) 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'; @@ -115,7 +116,8 @@ main (int argc, char **argv) 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 */ @@ -134,7 +136,8 @@ rmf (char *folder) 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: @@ -144,8 +147,7 @@ rmf (char *folder) 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; } @@ -154,8 +156,8 @@ rmf (char *folder) others = 0; /* - * Run the external delete hook program. - */ + ** Run the external delete hook program. + */ (void)ext_hook("del-hook", maildir, (char *)0); @@ -164,7 +166,8 @@ rmf (char *folder) 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 ',': @@ -181,7 +184,8 @@ rmf (char *folder) 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", @@ -198,9 +202,9 @@ rmf (char *folder) 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 (".."); @@ -219,9 +223,9 @@ rmf (char *folder) /* - * 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) @@ -234,16 +238,17 @@ 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;