static int link_is_dir (const char *folder, const char *path)
{
struct stat st;
- char fullpath[_POSIX_PATH_MAX];
+ BUFFER *fullpath = NULL;
+ int retval = 0;
- mutt_concat_path (fullpath, folder, path, sizeof (fullpath));
+ fullpath = mutt_buffer_pool_get ();
- if (stat (fullpath, &st) == 0)
- return (S_ISDIR (st.st_mode));
- else
- return 0;
+ mutt_buffer_concat_path (fullpath, folder, path);
+
+ if (stat (mutt_b2s (fullpath), &st) == 0)
+ retval = S_ISDIR (st.st_mode);
+
+ mutt_buffer_pool_release (&fullpath);
+
+ return retval;
}
static const char *
struct stat s;
DIR *dp;
struct dirent *de;
- char buffer[_POSIX_PATH_MAX + SHORT_STRING];
+ BUFFER *buffer = NULL;
BUFFY *tmp;
while (stat (d, &s) == -1)
return (-1);
}
+ buffer = mutt_buffer_pool_get ();
init_state (state, menu);
while ((de = readdir (dp)) != NULL)
if (!((regexec (Mask.rx, de->d_name, 0, NULL, 0) == 0) ^ Mask.not))
continue;
- mutt_concat_path (buffer, d, de->d_name, sizeof (buffer));
- if (lstat (buffer, &s) == -1)
+ mutt_buffer_concat_path (buffer, d, de->d_name);
+ if (lstat (mutt_b2s (buffer), &s) == -1)
continue;
/* No size for directories or symlinks */
continue;
tmp = Incoming;
- while (tmp && mutt_strcmp (buffer, tmp->path))
+ while (tmp && mutt_strcmp (mutt_b2s (buffer), tmp->path))
tmp = tmp->next;
if (tmp && Context &&
!mutt_strcmp (tmp->realpath, Context->realpath))
}
closedir (dp);
browser_sort (state);
+
+ mutt_buffer_pool_release (&buffer);
return 0;
}
struct stat s;
char buffer[LONG_STRING];
BUFFY *tmp = Incoming;
+ BUFFER *md = NULL;
if (!Incoming)
return (-1);
mutt_buffy_check (0);
+ md = mutt_buffer_pool_get ();
init_state (state, menu);
do
if (mx_is_maildir (tmp->path))
{
struct stat st2;
- char md[_POSIX_PATH_MAX];
- snprintf (md, sizeof (md), "%s/new", tmp->path);
- if (stat (md, &s) < 0)
+ mutt_buffer_printf (md, "%s/new", tmp->path);
+ if (stat (mutt_b2s (md), &s) < 0)
s.st_mtime = 0;
- snprintf (md, sizeof (md), "%s/cur", tmp->path);
- if (stat (md, &st2) < 0)
+ mutt_buffer_printf (md, "%s/cur", tmp->path);
+ if (stat (mutt_b2s (md), &st2) < 0)
st2.st_mtime = 0;
if (st2.st_mtime > s.st_mtime)
s.st_mtime = st2.st_mtime;
}
while ((tmp = tmp->next));
browser_sort (state);
+
+ mutt_buffer_pool_release (&md);
return 0;
}
static void init_menu (struct browser_state *state, MUTTMENU *menu, char *title,
size_t titlelen, int buffy)
{
- char path[_POSIX_PATH_MAX];
+ BUFFER *path = NULL;
+
+ path = mutt_buffer_pool_get ();
menu->max = state->entrylen;
snprintf (title, titlelen, _("Mailboxes [%d]"), mutt_buffy_check (0));
else
{
- strfcpy (path, mutt_b2s (LastDir), sizeof (path));
- mutt_pretty_mailbox (path, sizeof (path));
+ mutt_buffer_strcpy (path, mutt_b2s (LastDir));
+ mutt_buffer_pretty_mailbox (path);
#ifdef USE_IMAP
if (state->imap_browse && option (OPTIMAPLSUB))
snprintf (title, titlelen, _("Subscribed [%s], File mask: %s"),
- path, NONULL (Mask.pattern));
+ mutt_b2s (path), NONULL (Mask.pattern));
else
#endif
snprintf (title, titlelen, _("Directory [%s], File mask: %s"),
- path, NONULL(Mask.pattern));
+ mutt_b2s (path), NONULL(Mask.pattern));
}
menu->redraw = REDRAW_FULL;
+
+ mutt_buffer_pool_release (&path);
}
static int file_tag (MUTTMENU *menu, int n, int m)
for (i = 0, j = 0; i < state.entrylen; i++)
{
struct folder_file ff = state.entry[i];
- char full[_POSIX_PATH_MAX];
if (ff.tagged)
{
- mutt_concat_path (full, mutt_b2s (LastDir), ff.name, sizeof (full));
- mutt_expand_path (full, sizeof (full));
- tfiles[j++] = safe_strdup (full);
+ mutt_buffer_concat_path (tmp, mutt_b2s (LastDir), ff.name);
+ mutt_buffer_expand_path (tmp);
+ tfiles[j++] = safe_strdup (mutt_b2s (tmp));
}
}
*files = tfiles;