- if (stat (buf, &st) == 0)
- {
- if (S_ISDIR (st.st_mode))
- {
- destroy_state (&state);
- if (examine_directory (menu, &state, buf, prefix) == 0)
- strfcpy (LastDir, buf, sizeof (LastDir));
- else
- {
- mutt_error _("Error scanning directory.");
- 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);
- }
- else
- mutt_perror (buf);
- }
- MAYBE_REDRAW (menu->redraw);
- break;
-
- case OP_ENTER_MASK:
-
- strfcpy (buf, NONULL(Mask.pattern), sizeof (buf));
- if (mutt_get_field (_("File Mask: "), buf, sizeof (buf), 0) == 0)
- {
- regex_t *rx = (regex_t *) safe_malloc (sizeof (regex_t));
- char *s = buf;
- int not = 0, err;
-
- buffy = 0;
- /* assume that the user wants to see everything */
- if (!buf[0])
- strfcpy (buf, ".", sizeof (buf));
- SKIPWS (s);
- if (*s == '!')
- {
- s++;
- SKIPWS (s);
- not = 1;
- }
-
- if ((err = REGCOMP (rx, s, REG_NOSUB)) != 0)
- {
- regerror (err, rx, buf, sizeof (buf));
- regfree (rx);
- FREE (&rx);
- mutt_error ("%s", buf);
- }
- else
- {
- mutt_str_replace (&Mask.pattern, buf);
- regfree (Mask.rx);
- FREE (&Mask.rx);
- Mask.rx = rx;
- Mask.not = not;
-
- destroy_state (&state);
+ if (stat (buf, &st) == 0) {
+ if (S_ISDIR (st.st_mode)) {
+ destroy_state (&state);
+ if (examine_directory (menu, &state, buf, prefix) == 0)
+ m_strcpy(LastDir, sizeof(LastDir), buf);
+ else {
+ mutt_error _("Error scanning directory.");
+
+ 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);
+ }
+ else
+ mutt_perror (buf);
+ }
+ MAYBE_REDRAW (menu->redraw);
+ break;
+
+ case OP_ENTER_MASK:
+
+ m_strcpy(buf, sizeof(buf), NONULL(Mask.pattern));
+ if (mutt_get_field (_("File Mask: "), buf, sizeof (buf), 0) == 0) {
+ regex_t *rx = p_new(regex_t, 1);
+ char *s = buf;
+ int not = 0, err;
+
+ buffy = 0;
+ /* assume that the user wants to see everything */
+ if (!buf[0])
+ m_strcpy(buf, sizeof(buf), ".");
+ s = vskipspaces(s);
+ if (*s == '!') {
+ s = vskipspaces(s + 1);
+ not = 1;
+ }
+
+ if ((err = REGCOMP (rx, s, REG_NOSUB)) != 0) {
+ regerror (err, rx, buf, sizeof (buf));
+ regfree (rx);
+ p_delete(&rx);
+ mutt_error ("%s", buf);
+ }
+ else {
+ str_replace (&Mask.pattern, buf);
+ regfree (Mask.rx);
+ p_delete(&Mask.rx);
+ Mask.rx = rx;
+ Mask.not = not;
+
+ destroy_state (&state);