/*
- * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- * Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
+ * Copyright (C) 1996-2000,2002,2007 Michael R. Elkins <me@mutt.org>
+ * Copyright (C) 1999-2006 Thomas Roessler <roessler@does-not-exist.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "attach.h"
#include "mapping.h"
#include "mx.h"
-#include "copy.h"
#include "mutt_crypt.h"
#include <ctype.h>
{ N_("Pipe"), OP_PIPE },
{ N_("Print"), OP_PRINT },
{ N_("Help"), OP_HELP },
- { NULL }
+ { NULL, 0 }
};
void mutt_update_tree (ATTACHPTR **idx, short idxlen)
char path[_POSIX_PATH_MAX];
strfcpy (path, aptr->content->filename, sizeof (path));
- mutt_pretty_mailbox (path);
+ mutt_pretty_mailbox (path, sizeof (path));
mutt_format_s (dest, destlen, prefix, path);
}
else
return (src);
}
-void attach_entry (char *b, size_t blen, MUTTMENU *menu, int num)
+static void attach_entry (char *b, size_t blen, MUTTMENU *menu, int num)
{
mutt_FormatString (b, blen, 0, NONULL (AttachFormat), mutt_attach_fmt, (unsigned long) (((ATTACHPTR **)menu->data)[num]), M_FORMAT_ARROWCURSOR);
}
{
if (mutt_get_field (prompt, buf, sizeof (buf), M_FILE | M_CLEAR) != 0
|| !buf[0])
+ {
+ mutt_clear_error ();
return -1;
+ }
prompt = NULL;
mutt_expand_path (buf, sizeof (buf));
if (rc == 0 && AttachSep && (fpout = fopen (tfile,"a")) != NULL)
{
fprintf(fpout, "%s", AttachSep);
- fclose (fpout);
+ safe_fclose (&fpout);
}
}
else
if (rc == 0 && AttachSep && (fpout = fopen (tfile,"a")) != NULL)
{
fprintf(fpout, "%s", AttachSep);
- fclose (fpout);
+ safe_fclose (&fpout);
}
}
}
return;
}
mutt_copy_stream (ifp, state->fpout);
- fclose (ifp);
+ safe_fclose (&ifp);
if (AttachSep)
state_puts (AttachSep, state);
}
mutt_endwin (NULL);
thepid = mutt_create_filter (buf, &state.fpout, NULL, NULL);
pipe_attachment_list (buf, fp, tag, top, filter, &state);
- fclose (state.fpout);
+ safe_fclose (&state.fpout);
if (mutt_wait_filter (thepid) != 0 || option (OPTWAITKEY))
mutt_any_key_to_continue (NULL);
}
if ((ifp = fopen (newfile, "r")) != NULL)
{
mutt_copy_stream (ifp, state->fpout);
- fclose (ifp);
+ safe_fclose (&ifp);
if (AttachSep)
state_puts (AttachSep, state);
}
memset (&state, 0, sizeof (STATE));
thepid = mutt_create_filter (NONULL (PrintCmd), &state.fpout, NULL, NULL);
print_attachment_list (fp, tag, top, &state);
- fclose (state.fpout);
+ safe_fclose (&state.fpout);
if (mutt_wait_filter (thepid) != 0 || option (OPTWAITKEY))
mutt_any_key_to_continue (NULL);
}
print_attachment_list (fp, tag, top, &state);
}
-void
+static void
mutt_update_attach_index (BODY *cur, ATTACHPTR ***idxp,
short *idxlen, short *idxmax,
MUTTMENU *menu)
cur = hdr->content;
}
- menu = mutt_new_menu ();
- menu->menu = MENU_ATTACH;
+ menu = mutt_new_menu (MENU_ATTACH);
menu->title = _("Attachments");
menu->make_entry = attach_entry;
menu->tag = mutt_tag_attach;
if (WithCrypto && need_secured && secured)
{
- fclose (fp);
+ safe_fclose (&fp);
mutt_free_body (&cur);
}