X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=browser.c;h=f0dc1837874f070f52e6b6b55783a6b9240b9d2b;hp=61bf178fedf39bede994f497160fd1a731982244;hb=fbce8661618b322f5cfd8efd6ead47163b04d69a;hpb=67b2c8d6719bccd621e47b59cb89b9e2cb97d4f5 diff --git a/browser.c b/browser.c index 61bf178..f0dc183 100644 --- a/browser.c +++ b/browser.c @@ -16,6 +16,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ +#if HAVE_CONFIG_H +# include "config.h" +#endif + #include "mutt.h" #include "mutt_curses.h" #include "mutt_menu.h" @@ -644,7 +648,7 @@ static int examine_mailboxes (MUTTMENU *menu, struct browser_state *state) return 0; } -int select_file_search (MUTTMENU *menu, regex_t *re, int n) +static int select_file_search (MUTTMENU *menu, regex_t *re, int n) { #ifdef USE_NNTP if (option (OPTNEWS)) @@ -653,7 +657,7 @@ int select_file_search (MUTTMENU *menu, regex_t *re, int n) return (regexec (re, ((struct folder_file *) menu->data)[n].name, 0, NULL, 0)); } -void folder_entry (char *s, size_t slen, MUTTMENU *menu, int num) +static void folder_entry (char *s, size_t slen, MUTTMENU *menu, int num) { FOLDER folder; @@ -715,7 +719,7 @@ static void init_menu (struct browser_state *state, MUTTMENU *menu, char *title, menu->redraw = REDRAW_FULL; } -int file_tag (MUTTMENU *menu, int n, int m) +static int file_tag (MUTTMENU *menu, int n, int m) { struct folder_file *ff = &(((struct folder_file *)menu->data)[n]); int ot; @@ -803,8 +807,8 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num else { getcwd (LastDir, sizeof (LastDir)); - strcat (LastDir, "/"); /* __STRCAT_CHECKED__ */ - strncat (LastDir, f, i); + safe_strcat (LastDir, sizeof (LastDir), "/"); + safe_strncat (LastDir, sizeof (LastDir), f, i); } } else @@ -1177,21 +1181,21 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num { if (S_ISDIR (st.st_mode)) { - strfcpy (LastDir, buf, sizeof (LastDir)); destroy_state (&state); - if (examine_directory (menu, &state, LastDir, prefix) == 0) - { - menu->current = 0; - menu->top = 0; - init_menu (&state, menu, title, sizeof (title), buffy); - } + if (examine_directory (menu, &state, buf, prefix) == 0) + strfcpy (LastDir, buf, sizeof (LastDir)); else { mutt_error _("Error scanning directory."); - destroy_state (&state); - mutt_menuDestroy (&menu); - goto bail; + if (examine_directory (menu, &state, LastDir, prefix) == -1) + { + mutt_menuDestroy (&menu); + goto bail; + } } + menu->current = 0; + menu->top = 0; + init_menu (&state, menu, title, sizeof (title), buffy); } else mutt_error (_("%s is not a directory."), buf);