#include <lib-lib/lib-lib.h>
#include <lib-mime/mime.h>
+#include <lib-sys/unix.h>
#include <lib-ui/curses.h>
#include <lib-ui/enter.h>
#include <lib-ui/menu.h>
#include <lib-mx/mx.h>
-
-#include <lib-sys/unix.h>
+#include <lib-crypt/crypt.h>
#include "mutt.h"
#include "handler.h"
#include "recvattach.h"
#include "attach.h"
#include "copy.h"
-#include <lib-crypt/crypt.h>
-
-static const char *Mailbox_is_read_only = N_("Mailbox is read-only.");
-static char LastSaveFolder[_POSIX_PATH_MAX] = "";
-
-#define CHECK_READONLY if (Context->readonly) \
-{\
- mutt_flushinp (); \
- mutt_error _(Mailbox_is_read_only); \
- break; \
-}
-
-#define SW (option(OPTMBOXPANE)?SidebarWidth:0)
+#define SW (option(OPTMBOXPANE)?SidebarWidth:0)
static struct mapping_t AttachHelp[] = {
{N_("Exit"), OP_EXIT},
{NULL, OP_NULL}
};
-static int mutt_extract_path (char *filename, char *path, ssize_t pathlen)
-{
- char *tmp = p_new(char, _POSIX_PATH_MAX);
- char *help_ptr;
-
- help_ptr = tmp;
-
- while (*filename != '\0') {
- if (*filename == '/') {
- *help_ptr++ = *filename++;
- *help_ptr++ = '\0';
- m_strcat(path, pathlen, tmp);
- help_ptr = tmp;
- }
- *help_ptr++ = *filename++;
- }
- p_delete(&tmp);
- return 0;
-}
-
void mutt_update_tree (ATTACHPTR ** idx, short idxlen)
{
char buf[STRING];
{
char *prompt;
char buf[_POSIX_PATH_MAX], tfile[_POSIX_PATH_MAX];
- char path[_POSIX_PATH_MAX] = "";
int is_message;
int append = 0;
int rc;
prompt = _("Save to file ('#' for last used folder): ");
while (prompt) {
- ret =
- mutt_get_field (prompt, buf, sizeof (buf),
- M_FILE | M_CLEAR | M_LASTFOLDER);
+ static char LastSaveFolder[_POSIX_PATH_MAX] = ".";
+
+ ret = mutt_get_field(prompt, buf, sizeof (buf),
+ M_FILE | M_CLEAR | M_LASTFOLDER);
if (((ret != 0) && (ret != 2)) || (!buf[0] && ret != 2))
return -1;
if (ret == 2) {
char tmpbuf[_POSIX_PATH_MAX];
- snprintf (tmpbuf, sizeof (tmpbuf), "%s%s", LastSaveFolder, buf);
+ snprintf (tmpbuf, sizeof (tmpbuf), "%s/%s", LastSaveFolder, buf);
m_strcpy(buf, sizeof(buf), tmpbuf);
- ret = mutt_get_field (_("Save to file: ")
- , buf, sizeof (buf), M_FILE);
+ ret = mutt_get_field(_("Save to file: "), buf, sizeof (buf), M_FILE);
if ((ret != 0) || (!buf[0]))
return -1;
}
- else {
- mutt_extract_path (buf, path, sizeof(path));
- m_strcpy(LastSaveFolder, sizeof(LastSaveFolder), path);
- }
+ m_dirname(LastSaveFolder, sizeof(LastSaveFolder), buf);
prompt = NULL;
- mutt_expand_path (buf, sizeof (buf));
+ mutt_expand_path(buf, sizeof (buf));
is_message = (fp &&
body->hdr &&
attach_collapse (cur, 0, 1, 0);
mutt_update_attach_index (cur, &idx, &idxlen, &idxmax, menu);
+#define CHECK_READONLY \
+ if (Context->readonly) { \
+ mutt_flushinp (); \
+ mutt_error _("Mailbox is read-only."); \
+ break; \
+ }
+
#define CHECK_ATTACH \
if (option(OPTATTACHMSG)) { \
mutt_flushinp (); \