X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/13326ef23c4764f02e63a549b14492d80a7869a8..0e7daaa2daf6c668c8c6feb9da3c9a6639fa4e7e:/uip/rmf.c?ds=sidebyside diff --git a/uip/rmf.c b/uip/rmf.c index 4558ca30..6a86fe6a 100644 --- a/uip/rmf.c +++ b/uip/rmf.c @@ -8,6 +8,7 @@ */ #include +#include #define RMF_SWITCHES \ X("interactive", 0, INTRSW) \ @@ -91,7 +92,7 @@ main (int argc, char **argv) interactive = defolder; if (strchr (folder, '/') && (*folder != '/') && (*folder != '.')) { - for (cp = copy (folder, newfolder); cp > newfolder && *cp != '/'; cp--) + for (cp = stpcpy(newfolder, folder); cp > newfolder && *cp != '/'; cp--) continue; if (cp > newfolder) *cp = '\0'; @@ -123,7 +124,7 @@ main (int argc, char **argv) static int rmf (char *folder) { - int i, j, others; + int i, others; char *maildir; char cur[BUFSIZ]; struct dirent *dp; @@ -132,7 +133,8 @@ rmf (char *folder) switch (i = chdir (maildir = m_maildir (folder))) { case OK: if (access (".", W_OK) != NOTOK && access ("..", W_OK) != NOTOK) - break; /* fall otherwise */ + break; + /* FALLTHRU */ case NOTOK: snprintf (cur, sizeof(cur), "atr-%s-%s", @@ -156,13 +158,13 @@ rmf (char *folder) (void)ext_hook("del-hook", maildir, NULL); - j = strlen(BACKUP_PREFIX); while ((dp = readdir (dd))) { switch (dp->d_name[0]) { case '.': if (strcmp (dp->d_name, ".") == 0 || strcmp (dp->d_name, "..") == 0) - continue; /* else fall */ + continue; + /* FALLTHRU */ case ',': break; @@ -171,7 +173,7 @@ rmf (char *folder) if (m_atoi (dp->d_name)) break; if (strcmp (dp->d_name, LINK) == 0 - || strncmp (dp->d_name, BACKUP_PREFIX, j) == 0) + || has_prefix(dp->d_name, BACKUP_PREFIX)) break; admonish (NULL, "file \"%s/%s\" not deleted",