#include <lib-lib/mem.h>
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
+#include <lib-lib/file.h>
#include "mutt.h"
#include "enter.h"
struct stat st;
char fullpath[_POSIX_PATH_MAX];
- mutt_concat_path (fullpath, folder, path, sizeof (fullpath));
+ mutt_concat_path(fullpath, sizeof(fullpath), folder, path);
if (stat (fullpath, &st) == 0)
return (S_ISDIR (st.st_mode));
break;
case 'f':
- strncpy (fn, folder->ff->name, sizeof (fn) - 1);
+ m_strcpy(fn, sizeof(fn), folder->ff->name);
snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
snprintf (dest, destlen, tmp, fn);
break;
if (!((regexec (Mask.rx, de->d_name, 0, NULL, 0) == 0) ^ Mask.not))
continue;
- mutt_concat_path (buffer, d, de->d_name, sizeof (buffer));
+ mutt_concat_path(buffer, sizeof(buffer), d, de->d_name);
if (lstat (buffer, &s) == -1)
continue;
for (i = m_strlen(f) - 1; i > 0 && f[i] != '/'; i--);
if (i > 0) {
if (f[0] == '/') {
- if (i > sizeof (LastDir) - 1)
- i = sizeof (LastDir) - 1;
- strncpy (LastDir, f, i);
- LastDir[i] = 0;
+ i = MIN(sizeof(LastDir) - 1, i);
+ m_strcpy(LastDir, sizeof(LastDir), f);
}
else {
getcwd (LastDir, sizeof (LastDir));
}
#endif
else
- mutt_concat_path (buf, LastDir, state.entry[menu->current].name,
- sizeof (buf));
+ mutt_concat_path(buf, sizeof(buf), LastDir,
+ state.entry[menu->current].name);
if ((mx_get_magic (buf) <= 0)
#ifdef USE_IMAP
else {
char tmp[_POSIX_PATH_MAX];
- mutt_concat_path (tmp, LastDir, state.entry[menu->current].name,
- sizeof (tmp));
+ mutt_concat_path(tmp, sizeof(tmp), LastDir,
+ state.entry[menu->current].name);
strfcpy (LastDir, tmp, sizeof (LastDir));
}
strfcpy (f, state.entry[menu->current].name, flen);
#endif
else
- mutt_concat_path (f, LastDir, state.entry[menu->current].name, flen);
+ mutt_concat_path(f, flen, LastDir, state.entry[menu->current].name);
/* Fall through to OP_EXIT */
char full[_POSIX_PATH_MAX];
if (ff.tagged) {
- mutt_concat_path (full, LastDir, ff.name, sizeof (full));
+ mutt_concat_path(full, sizeof(full), LastDir, ff.name);
mutt_expand_path (full, sizeof (full));
tfiles[j++] = m_strdup(full);
}
BODY *b;
char buf[_POSIX_PATH_MAX];
- mutt_concat_path (buf, LastDir, state.entry[menu->current].name,
- sizeof (buf));
+ mutt_concat_path(buf, sizeof(buf), LastDir,
+ state.entry[menu->current].name);
b = mutt_make_file_attach (buf);
if (b != NULL) {
mutt_view_attachment (NULL, b, M_REGULAR, NULL, NULL, 0);