if (delim == folder[flen - 1])
if (flen == 0 || delim == folder[flen - 1])
static void add_folder (char delim, char *folder, char *host, int port,     int noselect, int noinferiors, struct browser_state *state){  char tmp[LONG_STRING];  char idir[LONG_STRING];  int flen = strlen (folder);  int x;  char *f;  imap_unquote_string (folder);  for (x = 0; x < state->entrylen; x++)  {    f = strchr ((state->entry)[x].name, '}');    if (f)    {      int len = strlen (folder);      f++;      if (!strncmp (f, folder, len) && (f[len] == '\0' || f[len] == delim))	return;    }  }  if (state->entrylen + 1 == state->entrymax)  {    safe_realloc ((void **) &state->entry,	sizeof (struct folder_file) * (state->entrymax += 256));  }  if (!noselect)  {    if (port == IMAP_PORT)      snprintf (tmp, sizeof (tmp), "{%s}%s", host, folder);    else      snprintf (tmp, sizeof (tmp), "{%s:%d}%s", host, port, folder);    (state->entry)[state->entrylen].name = safe_strdup (tmp);    snprintf (tmp, sizeof (tmp), "IMAP %-25s %-25s", host, folder);    (state->entry)[state->entrylen].desc = safe_strdup (tmp);    (state->entry)[state->entrylen].notfolder = 0;    (state->entrylen)++;  }  if (!noinferiors)  {    int nodelim = 0;    if (delim == folder[flen - 1])      nodelim = 1;    if (port == IMAP_PORT)      snprintf (tmp, sizeof (tmp), "{%s}%s%c", host, folder, 	  nodelim ? '\0' : delim);    else      snprintf (tmp, sizeof (tmp), "{%s:%d}%s%c", host, port, folder, 	  nodelim ? '\0' : delim);    (state->entry)[state->entrylen].name = safe_strdup (tmp);    snprintf (idir, sizeof (idir), "%s%c", folder, 	nodelim ? '\0' : delim);    snprintf (tmp, sizeof (tmp), "IMAP %-25s %-25s", host, idir);    (state->entry)[state->entrylen].desc = safe_strdup (tmp);    (state->entry)[state->entrylen].notfolder = 1;    (state->entrylen)++;  }}