From: Chris Hanson Date: Wed, 5 Jul 2000 22:57:14 +0000 (+0000) Subject: Read non-text attachments in binary mode. X-Git-Tag: 20090517-FFI~3375 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=db05b7d3b9d442aa7ac0a18eeda3d1c1742745e8;p=mit-scheme.git Read non-text attachments in binary mode. --- diff --git a/v7/src/edwin/sendmail.scm b/v7/src/edwin/sendmail.scm index 9ec6a956f..dfa7c92f0 100644 --- a/v7/src/edwin/sendmail.scm +++ b/v7/src/edwin/sendmail.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: sendmail.scm,v 1.65 2000/07/05 22:37:58 cph Exp $ +;;; $Id: sendmail.scm,v 1.66 2000/07/05 22:57:14 cph Exp $ ;;; ;;; Copyright (c) 1991-2000 Massachusetts Institute of Technology ;;; @@ -943,15 +943,18 @@ the user from the mailer." #f))) (lambda (initialize update finalize text?) (let ((context (initialize output-port text?))) - (call-with-input-file (mime-attachment-pathname attachment) - (lambda (input-port) - (let ((buffer (make-string 4096))) - (let loop () - (let ((n-read (read-string! buffer input-port))) - (if (> n-read 0) - (begin - (update context buffer 0 n-read) - (loop)))))))) + ((if (eq? type 'TEXT) + call-with-input-file + call-with-binary-input-file) + (mime-attachment-pathname attachment) + (lambda (input-port) + (let ((buffer (make-string 4096))) + (let loop () + (let ((n-read (read-string! buffer input-port))) + (if (> n-read 0) + (begin + (update context buffer 0 n-read) + (loop)))))))) (finalize context))))))))) (define (enable-buffer-mime-processing! buffer)