void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *numfiles)
{
char buf[_POSIX_PATH_MAX];
- char prefix[_POSIX_PATH_MAX] = "";
+ BUFFER *prefix = NULL;
char helpstr[LONG_STRING];
char title[STRING];
struct browser_state state;
buffy = buffy && folder;
+ OldLastDir = mutt_buffer_pool_get ();
+ tmp = mutt_buffer_pool_get ();
+ prefix = mutt_buffer_pool_get ();
+
memset (&state, 0, sizeof (struct browser_state));
if (!LastDir)
}
if (i <= 0 && f[0] != '/')
- strfcpy (prefix, f, sizeof (prefix));
+ mutt_buffer_strcpy (prefix, f);
else
- strfcpy (prefix, f + i + 1, sizeof (prefix));
+ mutt_buffer_strcpy (prefix, f + i + 1);
killPrefix = 1;
#ifdef USE_IMAP
}
#ifdef USE_IMAP
if (!state.imap_browse)
#endif
- if (examine_directory (NULL, &state, mutt_b2s (LastDir), prefix) == -1)
+ if (examine_directory (NULL, &state, mutt_b2s (LastDir), mutt_b2s (prefix)) == -1)
goto bail;
menu = mutt_new_menu (MENU_FOLDER);
init_menu (&state, menu, title, sizeof (title), buffy);
- OldLastDir = mutt_buffer_pool_get ();
- tmp = mutt_buffer_pool_get ();
-
FOREVER
{
switch (op = mutt_menuLoop (menu))
destroy_state (&state);
if (killPrefix)
{
- prefix[0] = 0;
+ mutt_buffer_clear (prefix);
killPrefix = 0;
}
buffy = 0;
}
else
#endif
- if (examine_directory (menu, &state, mutt_b2s (LastDir), prefix) == -1)
+ if (examine_directory (menu, &state, mutt_b2s (LastDir), mutt_b2s (prefix)) == -1)
{
/* try to restore the old values */
mutt_buffer_strcpy (LastDir, mutt_b2s (OldLastDir));
- if (examine_directory (menu, &state, mutt_b2s (LastDir), prefix) == -1)
+ if (examine_directory (menu, &state, mutt_b2s (LastDir), mutt_b2s (prefix)) == -1)
{
mutt_buffer_strcpy (LastDir, NONULL(Homedir));
goto bail;
if (S_ISDIR (st.st_mode))
{
destroy_state (&state);
- if (examine_directory (menu, &state, buf, prefix) == 0)
+ if (examine_directory (menu, &state, buf, mutt_b2s (prefix)) == 0)
mutt_buffer_strcpy (LastDir, buf);
else
{
mutt_error _("Error scanning directory.");
- if (examine_directory (menu, &state, mutt_b2s (LastDir), prefix) == -1)
+ if (examine_directory (menu, &state, mutt_b2s (LastDir), mutt_b2s (prefix)) == -1)
{
goto bail;
}
case OP_CHECK_NEW:
destroy_state (&state);
- prefix[0] = 0;
+ mutt_buffer_clear (prefix);
killPrefix = 0;
if (buffy)
menu->data = state.entry;
}
#endif
- else if (examine_directory (menu, &state, mutt_b2s (LastDir), prefix) == -1)
+ else if (examine_directory (menu, &state, mutt_b2s (LastDir), mutt_b2s (prefix)) == -1)
goto bail;
init_menu (&state, menu, title, sizeof (title), buffy);
break;
bail:
mutt_buffer_pool_release (&OldLastDir);
mutt_buffer_pool_release (&tmp);
+ mutt_buffer_pool_release (&prefix);
if (menu)
{