if (isparent)
noselect = 1;
/* prune current folder from output */
- if (isparent || strncmp (name, mx.mbox, strlen (name)))
+ if (isparent || mutt_strncmp (name, mx.mbox, strlen (name)))
imap_add_folder (idata->delim, name, noselect, noinferiors, state,
isparent);
}
if (isparent)
strfcpy (relpath, "../", sizeof (relpath));
/* strip current folder from target, to render a relative path */
- else if (!strncmp (mx.mbox, folder, strlen (mx.mbox)))
- strfcpy (relpath, folder + strlen (mx.mbox), sizeof (relpath));
+ else if (!mutt_strncmp (mx.mbox, folder, mutt_strlen (mx.mbox)))
+ strfcpy (relpath, folder + mutt_strlen (mx.mbox), sizeof (relpath));
else
strfcpy (relpath, folder, sizeof (relpath));
connflags = M_IMAP_CONN_NONEW;
if (!(idata = imap_conn_find (&(mx.account), connflags)))
- goto fail;
+ {
+ FREE (&mx.mbox);
+ return -1;
+ }
conn = idata->conn;
imap_fix_path (idata, mx.mbox, buf, sizeof (buf));
- /* Update the path, if it fits */
- if (strlen (buf) < strlen (mx.mbox))
- strcpy (mx.mbox, buf);
+ FREE (&mx.mbox);
imap_munge_mbox_name (mbox, sizeof(mbox), buf);
strfcpy (mbox_unquoted, buf, sizeof (mbox_unquoted));
else
/* Server does not support STATUS, and this is not the current mailbox.
* There is no lightweight way to check recent arrivals */
- goto fail;
+ return -1;
imap_cmd_start (idata, buf);
}
while (rc == IMAP_CMD_CONTINUE);
- FREE (&mx.mbox);
return msgcount;
-
- fail:
- FREE (&mx.mbox);
- return -1;
}
/* all this listing/browsing is a mess. I don't like that name is a pointer
int mutt_socket_close (CONNECTION* conn)
{
- int rc;
+ int rc = -1;
if (conn->fd < 0)
dprint (1, (debugfile, "mutt_socket_close: Attempt to close closed connection.\n"));
}
*q = 0;
- if (mutt_strncmp (s, Maildir, (len = mutt_strlen (Maildir))) == 0 && s[len] == '/')
+ if (mutt_strncmp (s, Maildir, (len = mutt_strlen (Maildir))) == 0)
{
+ /* chop off delimiters after Maildir. '.' is a hack because IMAP can
+ * use arbitrary delimiters, but we may not have a connection. Could
+ * call an IMAP delimiter getting function here later, otherwise
+ * default to this. */
+ if (s[len] != '/' && s[len] != '.')
+ len--;
*s++ = '=';
- strcpy (s, s + len);
+ memmove (s, s + len, mutt_strlen (s + len) + 1);
}
else if (mutt_strncmp (s, Homedir, (len = mutt_strlen (Homedir))) == 0 &&
s[len] == '/')
{
*s++ = '~';
- strcpy (s, s + len - 1);
+ memmove (s, s + len - 1, mutt_strlen (s + len - 1) + 1);
}
}