X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=complete.c;h=a385af4cb6ede49c1a05465f620ab23107ce487e;hp=2c0f14e6e02aa5554ca4b09d45a5492551b48014;hb=ecaab35b973fbceb58b5ed174971c82762cc0199;hpb=96d53ff49c308769efbf708e1e65819077cb7af6 diff --git a/complete.c b/complete.c index 2c0f14e..a385af4 100644 --- a/complete.c +++ b/complete.c @@ -20,7 +20,7 @@ #include "nntp.h" #endif -#include "lib/str.h" +#include #include "lib/debug.h" #include @@ -60,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 = m_strlen(filepart)) == 0) { for (; l; l = l->next) { NNTP_DATA *data = (NNTP_DATA *) l->data; @@ -77,7 +77,7 @@ int mutt_complete (char *s, size_t slen) NNTP_DATA *data = (NNTP_DATA *) l->data; if (data && data->subscribed && - safe_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]) { @@ -103,12 +103,8 @@ int mutt_complete (char *s, size_t slen) #ifdef USE_IMAP /* we can use '/' as a delimiter, imap_complete rewrites it */ if (*s == '=' || *s == '+' || *s == '!') { - if (*s == '!') - p = NONULL (Spoolfile); - else - p = NONULL (Maildir); - - mutt_concat_path (imap_path, p, s + 1, sizeof (imap_path)); + const char *q = NONULL(*s == '!' ? Spoolfile : Maildir); + mutt_concat_path (imap_path, q, s + 1, sizeof (imap_path)); } else strfcpy (imap_path, s, sizeof (imap_path)); @@ -176,10 +172,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 = m_strlen(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; @@ -188,7 +184,7 @@ int mutt_complete (char *s, size_t slen) } while ((de = readdir (dirp)) != NULL) { - if (safe_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]) { @@ -207,14 +203,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 + m_strlen(buf), "/", sizeof (buf) - m_strlen(buf)); } else buf[0] = 0; - strfcpy (buf + mutt_strlen (buf), filepart, sizeof (buf) - mutt_strlen (buf)); + strfcpy (buf + m_strlen(buf), filepart, sizeof (buf) - m_strlen(buf)); if (stat (buf, &st) != -1 && (st.st_mode & S_IFDIR)) - strfcpy (filepart + mutt_strlen (filepart), "/", - sizeof (filepart) - mutt_strlen (filepart)); + strfcpy (filepart + m_strlen(filepart), "/", + sizeof (filepart) - m_strlen(filepart)); init = 1; } } @@ -223,10 +219,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 + m_strlen(s), "/", slen - m_strlen(s)); + strfcpy (s + m_strlen(s), filepart, slen - m_strlen(s)); } else strfcpy (s, filepart, slen);