;;; mel-b-el.el --- Base64 encoder/decoder.
-;; Copyright (C) 1992,1995,1996,1997,1998,1999 Free Software Foundation, Inc.
+;; Copyright (C) 1992,95,96,97,98,99,2001 Free Software Foundation, Inc.
;; Author: ENAMI Tsugutomo <enami@sys.ptg.sony.co.jp>
;; MORIOKA Tomohiko <tomo@m17n.org>
;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Code:
:type '(cons (file :tag "Command")(repeat :tag "Arguments" string)))
(defcustom base64-external-decoder-option-to-specify-file '("-o")
- "*list of options of base64 decoder program to specify file."
+ "*list of options of base64 decoder program to specify file.
+If the base64 decoder program does not have such option, set this as nil."
:group 'base64
:type '(repeat :tag "Arguments" string))
(interactive "*r\nFWrite decoded region to file: ")
(if (and base64-internal-decoding-limit
(> (- end start) base64-internal-decoding-limit))
- (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))))
+ (progn
+ (as-binary-process
+ (apply (function call-process-region)
+ start end (car base64-external-decoder)
+ (null base64-external-decoder-option-to-specify-file)
+ (unless base64-external-decoder-option-to-specify-file
+ (list (current-buffer) nil))
+ nil
+ (delq nil
+ (append
+ (cdr base64-external-decoder)
+ base64-external-decoder-option-to-specify-file
+ (when base64-external-decoder-option-to-specify-file
+ (list filename))))))
+ (unless base64-external-decoder-option-to-specify-file
+ (write-region-as-binary (point-min) (point-max) filename)))
(let ((str (buffer-substring start end)))
(with-temp-buffer
(insert (base64-internal-decode-string str))