X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=complete.c;h=c909486b3be5ec53abdebabef2a674280c3acc66;hp=f21d9e8c190de39375d9e7da1675e580ff1e5a64;hb=3d8ec820b093cfe10a3738cfc8d8fedd813a73d7;hpb=841934011451205d8295ac955486f06c317fdf15 diff --git a/complete.c b/complete.c index f21d9e8..c909486 100644 --- a/complete.c +++ b/complete.c @@ -13,13 +13,16 @@ #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 "lib/debug.h" + #include #include #include @@ -45,7 +48,7 @@ int mutt_complete (char *s, size_t slen) char imap_path[LONG_STRING]; #endif - dprint (2, (debugfile, "mutt_complete: completing %s\n", s)); + debug_print (2, ("completing %s\n", s)); #ifdef USE_NNTP if (option (OPTNEWS)) { @@ -57,7 +60,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 = str_len (filepart)) == 0) { for (; l; l = l->next) { NNTP_DATA *data = (NNTP_DATA *) l->data; @@ -74,7 +77,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) { + str_ncmp (data->group, filepart, len) == 0) { if (init) { for (i = 0; filepart[i] && data->group[i]; i++) { if (filepart[i] != data->group[i]) { @@ -110,7 +113,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 @@ -165,9 +168,7 @@ int mutt_complete (char *s, size_t slen) } if (dirp == NULL) { - dprint (1, - (debugfile, "mutt_complete(): %s: %s (errno %d).\n", exp_dirpart, - strerror (errno), errno)); + debug_print (1, ("%s: %s (errno %d).\n", exp_dirpart, strerror (errno), errno)); return (-1); } @@ -175,10 +176,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 = str_len (filepart)) == 0) { while ((de = readdir (dirp)) != NULL) { - if (mutt_strcmp (".", de->d_name) != 0 - && mutt_strcmp ("..", de->d_name) != 0) { + if (str_cmp (".", de->d_name) != 0 + && str_cmp ("..", de->d_name) != 0) { strfcpy (filepart, de->d_name, sizeof (filepart)); init++; break; @@ -187,7 +188,7 @@ int mutt_complete (char *s, size_t slen) } while ((de = readdir (dirp)) != NULL) { - if (mutt_strncmp (de->d_name, filepart, len) == 0) { + if (str_ncmp (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 +207,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 + mutt_strlen (buf), "/", sizeof (buf) - mutt_strlen (buf)); + strfcpy (buf + str_len (buf), "/", sizeof (buf) - str_len (buf)); } else buf[0] = 0; - strfcpy (buf + mutt_strlen (buf), filepart, sizeof (buf) - mutt_strlen (buf)); + strfcpy (buf + str_len (buf), filepart, sizeof (buf) - str_len (buf)); if (stat (buf, &st) != -1 && (st.st_mode & S_IFDIR)) - strfcpy (filepart + mutt_strlen (filepart), "/", - sizeof (filepart) - mutt_strlen (filepart)); + strfcpy (filepart + str_len (filepart), "/", + sizeof (filepart) - str_len (filepart)); init = 1; } } @@ -222,10 +223,10 @@ int mutt_complete (char *s, size_t slen) if (dirpart[0]) { strfcpy (s, dirpart, slen); - if (mutt_strcmp ("/", dirpart) != 0 && dirpart[0] != '=' + if (str_cmp ("/", dirpart) != 0 && dirpart[0] != '=' && dirpart[0] != '+') - strfcpy (s + mutt_strlen (s), "/", slen - mutt_strlen (s)); - strfcpy (s + mutt_strlen (s), filepart, slen - mutt_strlen (s)); + strfcpy (s + str_len (s), "/", slen - str_len (s)); + strfcpy (s + str_len (s), filepart, slen - str_len (s)); } else strfcpy (s, filepart, slen);