From: Pierre Habouzit Date: Sun, 13 May 2007 16:25:24 +0000 (+0200) Subject: cleanups. X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=commitdiff_plain;h=c819524d3e0eb3c982c43d4ee88c148b1141397a cleanups. Signed-off-by: Pierre Habouzit --- diff --git a/lib-mx/mh.c b/lib-mx/mh.c index c94ef41..89ae790 100644 --- a/lib-mx/mh.c +++ b/lib-mx/mh.c @@ -1762,52 +1762,38 @@ static int mh_check_empty (const char *path) return r; } -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; + } + } - snprintf (tmp, sizeof (tmp), "%s/.overview", path); - if (access (tmp, F_OK) == 0) - return (M_MH); - } - return (-1); + return -1; } -static int maildir_is_magic (const char* path, struct stat* st) { - struct stat sb; - char tmp[_POSIX_PATH_MAX]; +static int maildir_is_magic (const char *path, struct stat *st) +{ + if (S_ISDIR(st->st_mode)) { + char tmp[_POSIX_PATH_MAX]; + struct stat sb; - if (S_ISDIR (st->st_mode)) { - snprintf (tmp, sizeof (tmp), "%s/cur", path); - if (stat (tmp, &sb) == 0 && S_ISDIR (sb.st_mode)) - return (M_MAILDIR); - } - return (-1); + snprintf(tmp, sizeof(tmp), "%s/cur", path); + if (stat(tmp, &sb) == 0 && S_ISDIR(sb.st_mode)) + return M_MAILDIR; + } + + return -1; } static int mh_commit (MESSAGE* msg, CONTEXT* ctx) { diff --git a/main.c b/main.c index 3002fb7..5e589af 100644 --- a/main.c +++ b/main.c @@ -32,6 +32,7 @@ #include "sort.h" #include "keymap.h" #include "mutt_idna.h" +#include "mutt_sasl.h" #ifdef HAVE_GETOPT_H #include