X-Git-Url: https://git.llucax.com/software/mutt-debian.git/blobdiff_plain/14c29200cb58d3c4a0830265f2433849781858d0..17be5eecfc074a5af14fb415d41be6a317273b07:/recvattach.c?ds=sidebyside diff --git a/recvattach.c b/recvattach.c index 1a46288..e2c4c77 100644 --- a/recvattach.c +++ b/recvattach.c @@ -1,6 +1,6 @@ /* - * Copyright (C) 1996-2000 Michael R. Elkins - * Copyright (C) 1999-2000 Thomas Roessler + * Copyright (C) 1996-2000,2002,2007 Michael R. Elkins + * Copyright (C) 1999-2006 Thomas Roessler * * 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 @@ -30,7 +30,6 @@ #include "attach.h" #include "mapping.h" #include "mx.h" -#include "copy.h" #include "mutt_crypt.h" #include @@ -56,7 +55,7 @@ static struct mapping_t AttachHelp[] = { { N_("Pipe"), OP_PIPE }, { N_("Print"), OP_PRINT }, { N_("Help"), OP_HELP }, - { NULL } + { NULL, 0 } }; void mutt_update_tree (ATTACHPTR **idx, short idxlen) @@ -254,7 +253,7 @@ const char *mutt_attach_fmt (char *dest, 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 @@ -363,7 +362,7 @@ const char *mutt_attach_fmt (char *dest, 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); } @@ -434,7 +433,10 @@ static int mutt_query_save_attachment (FILE *fp, BODY *body, HEADER *hdr, char * { 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)); @@ -519,7 +521,7 @@ void mutt_save_attachment_list (FILE *fp, int tag, BODY *top, HEADER *hdr, MUTTM if (rc == 0 && AttachSep && (fpout = fopen (tfile,"a")) != NULL) { fprintf(fpout, "%s", AttachSep); - fclose (fpout); + safe_fclose (&fpout); } } else @@ -528,7 +530,7 @@ void mutt_save_attachment_list (FILE *fp, int tag, BODY *top, HEADER *hdr, MUTTM if (rc == 0 && AttachSep && (fpout = fopen (tfile,"a")) != NULL) { fprintf(fpout, "%s", AttachSep); - fclose (fpout); + safe_fclose (&fpout); } } } @@ -623,7 +625,7 @@ static void pipe_attachment (FILE *fp, BODY *b, STATE *state) return; } mutt_copy_stream (ifp, state->fpout); - fclose (ifp); + safe_fclose (&ifp); if (AttachSep) state_puts (AttachSep, state); } @@ -672,7 +674,7 @@ void mutt_pipe_attachment_list (FILE *fp, int tag, BODY *top, int filter) 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); } @@ -738,7 +740,7 @@ static void print_attachment_list (FILE *fp, int tag, BODY *top, STATE *state) if ((ifp = fopen (newfile, "r")) != NULL) { mutt_copy_stream (ifp, state->fpout); - fclose (ifp); + safe_fclose (&ifp); if (AttachSep) state_puts (AttachSep, state); } @@ -772,7 +774,7 @@ void mutt_print_attachment_list (FILE *fp, int tag, BODY *top) 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); } @@ -780,7 +782,7 @@ void mutt_print_attachment_list (FILE *fp, int tag, BODY *top) print_attachment_list (fp, tag, top, &state); } -void +static void mutt_update_attach_index (BODY *cur, ATTACHPTR ***idxp, short *idxlen, short *idxmax, MUTTMENU *menu) @@ -1005,8 +1007,7 @@ void mutt_view_attachments (HEADER *hdr) 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; @@ -1244,7 +1245,7 @@ void mutt_view_attachments (HEADER *hdr) if (WithCrypto && need_secured && secured) { - fclose (fp); + safe_fclose (&fp); mutt_free_body (&cur); }