;; Copyright (C) 1998 Free Software Foundation, Inc.
;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;; Version: $Id: mel-dl.el,v 1.1 1998-01-11 16:21:43 morioka Exp $
+;; Version: $Id: mel-dl.el,v 1.2 1998-03-11 15:38:51 morioka Exp $
;; Keywords: MIME, Base64
;; This file is part of MEL (MIME Encoding Library).
(defvar base64-external-encoder '("mmencode")
"*list of base64 encoder program name and its arguments.")
+(defvar base64-external-decoder '("mmencode" "-u")
+ "*list of base64 decoder program name and its arguments.")
+
+(defvar base64-external-decoder-option-to-specify-file '("-o")
+ "*list of option of base64 decoder program to specify file.")
+
(defun base64-insert-encoded-file (filename)
"Encode contents of file FILENAME to base64, and insert the result.
It calls external base64 encoder specified by
filename t nil (cdr base64-external-encoder))
)
+(defun base64-write-decoded-region (start end filename)
+ "Decode and write current region encoded by base64 into FILENAME.
+START and END are buffer positions."
+ (interactive
+ (list (region-beginning) (region-end)
+ (read-file-name "Write decoded region to file: ")))
+ (as-binary-process
+ (apply (function call-process-region)
+ start end (car base64-external-decoder)
+ nil nil nil
+ (append (cdr base64-external-decoder)
+ base64-external-decoder-option-to-specify-file
+ (list filename))
+ )))
+
;;; @ etc
;;;