-static int mh_is_magic (const char* path, struct stat* st) {
- char tmp[_POSIX_PATH_MAX];
-
- if (S_ISDIR (st->st_mode)) {
- snprintf (tmp, sizeof (tmp), "%s/.mh_sequences", path);
- if (access (tmp, F_OK) == 0)
- return (M_MH);
-
- snprintf (tmp, sizeof (tmp), "%s/.xmhcache", path);
- if (access (tmp, F_OK) == 0)
- return (M_MH);
-
- snprintf (tmp, sizeof (tmp), "%s/.mew_cache", path);
- if (access (tmp, F_OK) == 0)
- return (M_MH);
-
- snprintf (tmp, sizeof (tmp), "%s/.mew-cache", path);
- if (access (tmp, F_OK) == 0)
- return (M_MH);
-
- snprintf (tmp, sizeof (tmp), "%s/.sylpheed_cache", path);
- if (access (tmp, F_OK) == 0)
- return (M_MH);
-
- /*
- * ok, this isn't an mh folder, but mh mode can be used to read
- * Usenet news from the spool. ;-)
- */
+static int mh_is_magic(const char *path, struct stat *st)
+{
+ static char const * const files[] = {
+ ".mh_sequences", ".xmhcache", ".mew_cache",
+ ".mew-cache", ".sylpheed_cache",
+ };
+
+ if (S_ISDIR(st->st_mode)) {
+ for (int i = 0; i < countof(files); i++) {
+ char tmp[_POSIX_PATH_MAX];
+
+ snprintf(tmp, sizeof(tmp), "%s/%s", path, files[i]);
+ if (access(tmp, F_OK) == 0)
+ return M_MH;
+ }
+ }