#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 <dirent.h>
#include <string.h>
#include <sys/types.h>
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)) {
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]) {
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
}
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);
}
}
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]) {
/* 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 + mutt_strlen (buf), "/", sizeof (buf) - mutt_strlen (buf));
}
else
buf[0] = 0;
- strfcpy (buf + strlen (buf), filepart, sizeof (buf) - strlen (buf));
+ strfcpy (buf + mutt_strlen (buf), filepart, sizeof (buf) - mutt_strlen (buf));
if (stat (buf, &st) != -1 && (st.st_mode & S_IFDIR))
- strfcpy (filepart + strlen (filepart), "/",
- sizeof (filepart) - strlen (filepart));
+ strfcpy (filepart + mutt_strlen (filepart), "/",
+ sizeof (filepart) - mutt_strlen (filepart));
init = 1;
}
}
strfcpy (s, dirpart, slen);
if (mutt_strcmp ("/", dirpart) != 0 && dirpart[0] != '='
&& dirpart[0] != '+')
- strfcpy (s + strlen (s), "/", slen - strlen (s));
- strfcpy (s + strlen (s), filepart, slen - strlen (s));
+ strfcpy (s + mutt_strlen (s), "/", slen - mutt_strlen (s));
+ strfcpy (s + mutt_strlen (s), filepart, slen - mutt_strlen (s));
}
else
strfcpy (s, filepart, slen);