From:	SMTP%"vmsserv@kcl.ac.uk" 18-SEP-1995 14:15:41.88
To:	everhart@star.zko.dec.com
CC:	
Subj:	MMENCODE.2-OF-2

-+-+-+-+-+-+-+-+ START OF PART 2 -+-+-+-+-+-+-+-+
XX-ListName: Message Exchange Discussion List <M\2F06@WKUVX1.WKU.EDU>
XWarnings-To: <>
XErrors-To: List-Mgr@WKUVX1.WKU.EDU
XSender: List-Mgr@WKUVX1.WKU.EDU
XDate: Wed, 09 Mar 1994 13:26:38 EST
XFrom: "Brian Tillman" <t\0A06@swdev.si.com>
XReply-To: MX-List@WKUVX1.WKU.EDU
XTo: mx-list@wku.edu
XMessage-ID: <0097B2D8.6669D140.16202@swdev.si.com>
XSubject: External Mime encoding/decoding
X
XSeveral people have asked about a MIME (BASE64 or Quoted-Printable) decoder th
Vat`20
Xcan be used outside of MX to encode/decode.  Below you will find the sources f
Vor`20
Xsuch a decoder.  I obtained it from Pete Sivia on DECUServe, who in turn`20
Xobtained it from the MIME base distribution.  I've packag\3306up as a VMS_SHAR
VE`20
Xcollection.  It compiles with VAX C V3.2.  The form of the command is:
X
X$ mmencode `5B-u`5D `5B-b`5D `5B-q`5D `5B-p`5D `5B-o outfile`5D `5Binfile`5D
X
XIf -u is absent, the infile is encoded.  \2909specified, \280Ade\2806
XIf -b is specified, the encoding/decoding is BASE64
XIf -q is specified, the encoding/decoding is Quoted-Printable
XIf -p is specified, newlines are passed back to the encoding/decoding process
V`20
X(I'm not sure what this used for).
XIf -o outfile is specified, the encoding/decoding is placed in\3908
X
XThere is also a READ_MIME.COM procedure included to provide an interactive fro
Vnt`20
Xend to MMENCODE.
$ call unpack [.MMENCODE]MMENCODE.README;1 1684091035 "" 4 5 6
$!
$ create 'f'
X$ MMENCODE = "$" + f$parse("\1A08.EXE;",f$environment("PROCEDURE"))-"\2406
X$!
X$! READ_MIME.COM
X$!
X$! Run either by prompts or by @READ_MINE inputfile out\0B081or2
X$! (1or2 means 1=BASE64, 2=QUOTE-PRINTABLE encoding)`20
X$!
X$WRITE SYS$OUTPUT "This routine converts a MIME-encoded message into
X$WRITE SYS$OUTPUT "something readable.  Two formats are supported --"
X$WRITE SYS$OUTPUT "BASE64 and QUOTE-PRINTABLE.  Determine which is used"
X$WRITE SYS$OUTPUT "by reading the header line entitled:
X$WRITE SYS$OUTPUT "Content-Transfer-Encoding"
X$WRITE SYS$OUTPUT ""
X$IF ("''P1'" .EQS. "") THEN READ/PROMPT="Input file? " SYS$COMMAND P1
X$IF ("''P1'" .EQS. "") THEN EXIT
X$IF ("''P2'" .EQS. "") THEN READ/PROMPT="Output file? " SYS$COMMAND P2
X$IF ("''P2'" .EQS. "") THEN EXIT
X$!
X$SEARCH 'P1' "Content-Transfer-Encoding"
X$!
X$IF ("''P3'" .EQS. "1" .OR. "\170E2") THEN GOTO DO_IT
X$!
X$WRITE SYS$OUTPUT "Is this BASE64 (1) or QUOTE-PRINTABLE (2)"
X$READ/PROMPT="Enter 1 or 2 (D=2) " SYS$COMMAND X
X$IF ("''X'" .EQS. "") THEN X=2
X$IF ("''X'" .NES. "1" .AND. "\170D2") THEN EXIT
X$!
X$DO_IT:
X$IF ("''X'" .EQS. "1")
X`09$THEN
X`09`09$MMENCODE -u -b -o 'P2' 'P1'
X`09$ELSE
X`09`09$MMENCODE -u -q -o 'P2' 'P1'
X$ENDIF
X$!
X$WRITE SYS$OUTPUT "Done.  Original file ''P1'; Converted\16092'"
X$EXIT
$ call unpack [.MMENCODE]READ_MIME.COM;2 594685005 "" 3 6 6
$ v=f$verify(v)
$ exit
================== RFC 822 Headers ==================
Return-Path: vmsserv@kcl.ac.uk
Received: by delphi.zko.dec.com (UCX V3.2 VAX)
	Mon, 18 Sep 1995 14:15:22 -0400
Received: from newt.kcl.ac.uk by mail2.digital.com; (5.65 EXP 4/12/95 for V3.2/1.0/WV)
	id AA18688; Mon, 18 Sep 1995 11:03:49 -0700
Received: from kcl.ac.uk by newt.kcl.ac.uk with SMTP (PP) 
          id <03178-0@newt.kcl.ac.uk>; Mon, 18 Sep 1995 19:02:30 +0100
Received: by bay.cc.kcl.ac.uk (MX V4.1 AXP) id 328;
          Mon, 18 Sep 1995 19:03:12 GMT
Date: Mon, 18 Sep 1995 19:03:13 GMT
From: Kings College London File Server <vmsserv@kcl.ac.uk>
To: everhart@star.zko.dec.com
Message-Id: <00996981.DE4A6E2A.328@bay.cc.kcl.ac.uk>
Subject: MMENCODE.2-OF-2
