int imap_complete(char* dest, char* path) {
int imap_complete(char* dest, size_t dlen, char* path) {
int imap_complete(char* dest, char* path) {  CONNECTION* conn;  IMAP_DATA* idata;  char host[SHORT_STRING];  int port;  char list[LONG_STRING];  char buf[LONG_STRING];  char seq[16];  char* mbox = NULL;  char* list_word = NULL;  int noselect, noinferiors;  char delim;  char completion[LONG_STRING];  int clen, matchlen = 0;  int completions = 0;  int pos = 0;  /* verify passed in path is an IMAP path */  if (imap_parse_path (path, host, sizeof(host), &port, &mbox))  {    dprint(2, (debugfile, "imap_complete: bad path %s\n", path));    return -1;  }  conn = mutt_socket_select_connection (host, port, 0);  idata = CONN_DATA;  /* don't open a new socket just for completion */  if (!idata)  {    dprint (2, (debugfile,      "imap_complete: refusing to open new connection for %s", path));    return -1;  }  /* reformat path for IMAP list, and append wildcard */  /* don't use INBOX in place of "" */  if (mbox[0])    imap_fix_path (idata, mbox, list, sizeof(list));  else    list[0] = '\0';  /* fire off command */  imap_make_sequence (seq, sizeof(seq));  snprintf (buf, sizeof(buf), "%s %s \"\" \"%s%%\"\r\n", seq,     option (OPTIMAPLSUB) ? "LSUB" : "LIST", list);  mutt_socket_write (conn, buf);  /* and see what the results are */  strfcpy (completion, mbox, sizeof(completion));  do  {    if (imap_parse_list_response(conn, buf, sizeof(buf), &list_word,        &noselect, &noinferiors, &delim))      break;    if (list_word)    {      /* if the folder isn't selectable, append delimiter to force browse       * to enter it on second tab. */      if (noselect)      {        clen = strlen(list_word);        list_word[clen++] = delim;        list_word[clen] = '\0';      }      /* copy in first word */      if (!completions)      {        strfcpy (completion, list_word, sizeof(completion));        matchlen = strlen (completion);        completions++;        continue;      }      pos = 0;      while (pos < matchlen && list_word[pos] &&          completion[pos] == list_word[pos])        pos++;      completion[pos] = '\0';      matchlen = pos;      completions++;    }  }  while (mutt_strncmp(seq, buf, strlen(seq)));  if (completions)  {    /* reformat output */    if (port != IMAP_PORT)      sprintf (dest, "{%s:%d}%s", host, port, completion);    else      sprintf (dest, "{%s}%s", host, completion);        mutt_pretty_mailbox (dest);    return 0;  }  return -1;}