summaryrefslogtreecommitdiffstats
path: root/attach.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>2001-09-26 10:10:20 +0000
committerThomas Roessler <roessler@does-not-exist.org>2001-09-26 10:10:20 +0000
commit2e6bdb2e203b2035f224fceaea0391f21b16fd7c (patch)
treee1b62920f84b1206223ae997c890ad5608ee5cac /attach.c
parent2918013afbb59fc006ac0e2e926277e82312a2c0 (diff)
Fix attachment printing.
Diffstat (limited to 'attach.c')
-rw-r--r--attach.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/attach.c b/attach.c
index 37654d73..2cccafbb 100644
--- a/attach.c
+++ b/attach.c
@@ -896,6 +896,8 @@ int mutt_print_attachment (FILE *fp, BODY *a)
rfc1524_entry *entry;
int piped = FALSE;
+ dprint (2, (debugfile, "Using mailcap...\n"));
+
entry = rfc1524_new_entry ();
rfc1524_mailcap_lookup (a, type, entry, M_PRINT);
if (rfc1524_expand_filename (entry->nametemplate, a->filename,
@@ -964,8 +966,8 @@ int mutt_print_attachment (FILE *fp, BODY *a)
return (1);
}
- if (!ascii_strcasecmp ("text/plain", a->subtype) ||
- !ascii_strcasecmp ("application/postscript", a->subtype))
+ if (!ascii_strcasecmp ("text/plain", type) ||
+ !ascii_strcasecmp ("application/postscript", type))
{
return (mutt_pipe_attachment (fp, a, NONULL(PrintCmd), NULL));
}
@@ -981,11 +983,17 @@ int mutt_print_attachment (FILE *fp, BODY *a)
mutt_mktemp (newfile);
if (mutt_decode_save_attachment (fp, a, newfile, 0, 0) == 0)
{
+
+ dprint (2, (debugfile, "successfully decoded %s type attachment to %s\n",
+ type, newfile));
+
if ((ifp = fopen (newfile, "r")) == NULL)
{
mutt_perror ("fopen");
goto bail0;
}
+
+ dprint (2, (debugfile, "successfully opened %s read-only\n", newfile));
mutt_endwin (NULL);
if ((thepid = mutt_create_filter (NONULL(PrintCmd), &fpout, NULL, NULL)) < 0)
@@ -994,7 +1002,13 @@ int mutt_print_attachment (FILE *fp, BODY *a)
goto bail0;
}
+ dprint (2, (debugfile, "Filter created.\n"));
+
mutt_copy_stream (ifp, fpout);
+
+ safe_fclose (&fpout);
+ safe_fclose (&ifp);
+
if (mutt_wait_filter (thepid) != 0 || option (OPTWAITKEY))
mutt_any_key_to_continue (NULL);
rc = 1;