X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=complete.c;h=b0c96cfa68e383ca1cf7e50603fd18b49f999043;hp=8ff2dcece655e2201a2ab7aa9b14fdd303636f71;hb=972ceaccdfed1c8c4a665b2ecb9683d140fdeda2;hpb=c3e57678c8be193fc137854020f3a90887be97c9 diff --git a/complete.c b/complete.c index 8ff2dce..b0c96cf 100644 --- a/complete.c +++ b/complete.c @@ -13,13 +13,15 @@ #include "mutt.h" #ifdef USE_IMAP -#include "mailbox.h" +#include "mx.h" #include "imap.h" #endif #ifdef USE_NNTP #include "nntp.h" #endif +#include "lib/str.h" + #include #include #include @@ -57,7 +59,7 @@ int mutt_complete (char *s, size_t slen) * special case to handle when there is no filepart yet. * find the first subscribed newsgroup */ - if ((len = mutt_strlen (filepart)) == 0) { + if ((len = safe_strlen (filepart)) == 0) { for (; l; l = l->next) { NNTP_DATA *data = (NNTP_DATA *) l->data; @@ -74,7 +76,7 @@ int mutt_complete (char *s, size_t slen) NNTP_DATA *data = (NNTP_DATA *) l->data; if (data && data->subscribed && - mutt_strncmp (data->group, filepart, len) == 0) { + safe_strncmp (data->group, filepart, len) == 0) { if (init) { for (i = 0; filepart[i] && data->group[i]; i++) { if (filepart[i] != data->group[i]) { @@ -110,7 +112,7 @@ int mutt_complete (char *s, size_t slen) else strfcpy (imap_path, s, sizeof (imap_path)); - if (mx_is_imap (imap_path)) + if (mx_get_magic (imap_path) == M_IMAP) return imap_complete (s, slen, imap_path); #endif @@ -175,10 +177,10 @@ int mutt_complete (char *s, size_t slen) * special case to handle when there is no filepart yet. find the first * file/directory which is not ``.'' or ``..'' */ - if ((len = mutt_strlen (filepart)) == 0) { + if ((len = safe_strlen (filepart)) == 0) { while ((de = readdir (dirp)) != NULL) { - if (mutt_strcmp (".", de->d_name) != 0 - && mutt_strcmp ("..", de->d_name) != 0) { + if (safe_strcmp (".", de->d_name) != 0 + && safe_strcmp ("..", de->d_name) != 0) { strfcpy (filepart, de->d_name, sizeof (filepart)); init++; break; @@ -187,7 +189,7 @@ int mutt_complete (char *s, size_t slen) } while ((de = readdir (dirp)) != NULL) { - if (mutt_strncmp (de->d_name, filepart, len) == 0) { + if (safe_strncmp (de->d_name, filepart, len) == 0) { if (init) { for (i = 0; filepart[i] && de->d_name[i]; i++) { if (filepart[i] != de->d_name[i]) { @@ -206,14 +208,14 @@ int mutt_complete (char *s, size_t slen) /* check to see if it is a directory */ if (dirpart[0]) { strfcpy (buf, exp_dirpart, sizeof (buf)); - strfcpy (buf + strlen (buf), "/", sizeof (buf) - strlen (buf)); + strfcpy (buf + safe_strlen (buf), "/", sizeof (buf) - safe_strlen (buf)); } else buf[0] = 0; - strfcpy (buf + strlen (buf), filepart, sizeof (buf) - strlen (buf)); + strfcpy (buf + safe_strlen (buf), filepart, sizeof (buf) - safe_strlen (buf)); if (stat (buf, &st) != -1 && (st.st_mode & S_IFDIR)) - strfcpy (filepart + strlen (filepart), "/", - sizeof (filepart) - strlen (filepart)); + strfcpy (filepart + safe_strlen (filepart), "/", + sizeof (filepart) - safe_strlen (filepart)); init = 1; } } @@ -222,10 +224,10 @@ int mutt_complete (char *s, size_t slen) if (dirpart[0]) { strfcpy (s, dirpart, slen); - if (mutt_strcmp ("/", dirpart) != 0 && dirpart[0] != '=' + if (safe_strcmp ("/", dirpart) != 0 && dirpart[0] != '=' && dirpart[0] != '+') - strfcpy (s + strlen (s), "/", slen - strlen (s)); - strfcpy (s + strlen (s), filepart, slen - strlen (s)); + strfcpy (s + safe_strlen (s), "/", slen - safe_strlen (s)); + strfcpy (s + safe_strlen (s), filepart, slen - safe_strlen (s)); } else strfcpy (s, filepart, slen);