Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com From: "Gary R. Van Sickle" To: "Cygwin mailing list" Subject: [PATCH] improved mutt-1.2.5i binary attachment handling (fixed changelog, sorry) Date: Sat, 22 Sep 2001 02:53:55 -0500 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0000_01C14311.D1A76C80" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 ------=_NextPart_000_0000_01C14311.D1A76C80 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit This patch fixes mutt so that it can now send binary attachments regardless of mount mode. No work done on receiving yet. Tested with current Cygwin ssmtp distro. Changelog: 2001-09-22 Gary R. Van Sickle * lib.c (safe_fopen): Add support for binary mode specifier ("b"). * sendlib.c (mutt_write_mime_body): Open file to attach as binary prior to encoding if it is not a text MIME type. * configure.in (sig_atomic_t): Add brackets to sig_atomic_t test, it was generating an invalid configure. (binmode.o): Remove linkage to binmode.o to go back to default Cygwin file mode behavior. ------=_NextPart_000_0000_01C14311.D1A76C80 Content-Type: application/octet-stream; name="mutt.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="mutt.diff" --- mutt-1.2.5i/lib.c Tue May 16 10:23:12 2000 +++ mutt-1.2.5i-grvs/lib.c Sat Sep 22 01:21:00 2001 @@ -374,11 +374,19 @@ FILE *safe_fopen (const char *path, cons flags |=3D O_NOFOLLOW; #endif =20 - if (mode[1] =3D=3D '+') + if (strchr(mode, '+') !=3D NULL) flags |=3D O_RDWR; else flags |=3D O_WRONLY; =20 + /* Check if binary mode is specified */ +#ifdef O_BINARY + if(strchr(mode, 'b') !=3D NULL) + { + flags |=3D O_BINARY; + } +#endif + if ((fd =3D safe_open (path, flags)) < 0) return (NULL); =20 --- mutt-1.2.5i/sendlib.c Sat May 20 01:39:00 2000 +++ mutt-1.2.5i-grvs/sendlib.c Fri Sep 21 23:52:08 2001 @@ -482,8 +482,17 @@ int mutt_write_mime_body (BODY *a, FILE=20 #endif /* HAVE_PGP */ =20 =20 + /* Open the file to encode in the correct mode */ + if(mutt_is_text_type (a->type, a->subtype)) + { + fpin =3D fopen (a->filename, "r"); + } + else + { + fpin =3D fopen (a->filename, "rb"); + } =20 - if ((fpin =3D fopen (a->filename, "r")) =3D=3D NULL) + if (fpin =3D=3D NULL) { dprint(1,(debugfile, "write_mime_body: %s no longer = exists!\n",a->filename)); mutt_error (_("%s no longer exists!"), a->filename); --- mutt-1.2.5i/configure.in Sun Feb 4 16:24:00 2001 +++ mutt-1.2.5i-grvs/configure.in Sat Sep 22 00:57:04 2001 @@ -204,9 +204,9 @@ AC_CHECK_FUNCS(setrlimit) AC_TYPE_SIGNAL =20 AC_MSG_CHECKING(for sig_atomic_t in signal.h) -AC_EGREP_HEADER(sig_atomic_t,signal.h,dnl - [ ac_cv_type_sig_atomic_t=3Dyes; AC_MSG_RESULT(yes) ],dnl - AC_MSG_RESULT(no); AC_CHECK_TYPE(sig_atomic_t, int)) +AC_EGREP_HEADER(sig_atomic_t,signal.h, + [ ac_cv_type_sig_atomic_t=3Dyes; AC_MSG_RESULT(yes) ], + [ AC_MSG_RESULT(no); AC_CHECK_TYPE(sig_atomic_t, int) ]) =20 AC_DECL_SYS_SIGLIST =20 @@ -608,7 +608,6 @@ AC_SUBST(LIBIMAPDEPS) MUTT_AM_GNU_GETTEXT CPPFLAGS=3D"$CPPFLAGS -I\$(top_srcdir)/intl" =20 -test "$ac_cv_cygwin" =3D yes && LIBS=3D"$LIBS /usr/lib/binmode.o" test "$ac_cv_cygwin" =3D yes && DATADIRNAME=3Dshare =20 MUTTLOCALEDIR=3D$mutt_cv_prefix/$DATADIRNAME/locale ------=_NextPart_000_0000_01C14311.D1A76C80 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ------=_NextPart_000_0000_01C14311.D1A76C80--