From: Ralph Corderoy Date: Sun, 23 Oct 2016 22:44:58 +0000 (+0100) Subject: Use HasPrefix() instead of strncmp(). X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/c4f704eb5309d15ffb7c15fc67074f22d0647951?hp=9317c7994aca7aa34147859123c7ea80956daeb0 Use HasPrefix() instead of strncmp(). --- diff --git a/uip/rmf.c b/uip/rmf.c index 4558ca30..4684e7e0 100644 --- a/uip/rmf.c +++ b/uip/rmf.c @@ -8,6 +8,7 @@ */ #include +#include #define RMF_SWITCHES \ X("interactive", 0, INTRSW) \ @@ -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; @@ -156,7 +157,6 @@ rmf (char *folder) (void)ext_hook("del-hook", maildir, NULL); - j = strlen(BACKUP_PREFIX); while ((dp = readdir (dd))) { switch (dp->d_name[0]) { case '.': @@ -171,7 +171,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) + || HasPrefix(dp->d_name, BACKUP_PREFIX)) break; admonish (NULL, "file \"%s/%s\" not deleted",