Changeset 1909:5e5727753ad1 for commands.c
- Timestamp:
- 2000-06-15 14:15:51 (8 years ago)
- Branch:
- HEAD
- Files:
-
- 1 modified
-
commands.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
commands.c
r1896 r1909 26 26 #include "mx.h" 27 27 #include "pager.h" 28 #include <sys/types.h> 29 #include <sys/stat.h> 30 #include <fcntl.h> 28 31 29 32 #ifdef USE_IMAP … … 62 65 int rc = 0, builtin = 0; 63 66 int cmflags = M_CM_DECODE | M_CM_DISPLAY | M_CM_CHARCONV; 64 FILE *fpout; 67 FILE *fpout = NULL; 68 FILE *fpfilterout = NULL; 69 pid_t filterpid; 70 int res; 65 71 66 72 snprintf (buf, sizeof (buf), "%s/%s", TYPE (cur->content), … … 108 114 } 109 115 110 mutt_message_hook (cur, M_DISPLAYHOOK); 116 mutt_message_hook (cur, M_DISPLAYHOOK); 117 118 if (DisplayFilter && *DisplayFilter) 119 { 120 fpfilterout = fpout; 121 fpout = NULL; 122 endwin (); 123 filterpid = mutt_create_filter_fd (DisplayFilter, &fpout, NULL, NULL, 124 -1, fileno(fpfilterout), -1); 125 if (filterpid < 0) 126 { 127 mutt_error (_("Cannot create display filter")); 128 fclose (fpfilterout); 129 unlink (tempfile); 130 return 0; 131 } 132 } 111 133 112 134 if (!Pager || mutt_strcmp (Pager, "builtin") == 0) … … 119 141 } 120 142 121 if (mutt_copy_message (fpout, Context, cur, cmflags, 122 (option (OPTWEED) ? (CH_WEED | CH_REORDER) : 0) | CH_DECODE | CH_FROM) == -1) 123 { 124 fclose (fpout); 125 unlink (tempfile); 143 res = mutt_copy_message (fpout, Context, cur, cmflags, 144 (option (OPTWEED) ? (CH_WEED | CH_REORDER) : 0) | CH_DECODE | CH_FROM); 145 if ((fclose (fpout) != 0 && errno != EPIPE) || res == -1) 146 { 147 mutt_error (_("Could not copy message")); 148 if (fpfilterout != NULL) 149 mutt_wait_filter (filterpid); 150 mutt_unlink (tempfile); 126 151 return 0; 127 152 } 128 153 129 if (fclose (fpout) != 0 && errno != EPIPE) 130 { 131 mutt_perror ("fclose"); 132 mutt_unlink (tempfile); 133 return (0); 134 } 154 if (fpfilterout != NULL && mutt_wait_filter (filterpid) != 0) 155 mutt_any_key_to_continue (NULL); 135 156 136 157 #ifdef HAVE_PGP
