/usr/share/emacs/site-lisp/flim/mel-b-dl.el is in flim 1:1.14.9+0.20110516-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | ;;; mel-b-dl.el --- Base64 encoder/decoder using DL module.
;; Copyright (C) 1998,1999 Free Software Foundation, Inc.
;; Author: MORIOKA Tomohiko <tomo@m17n.org>
;; Keywords: MIME, Base64
;; This file is part of FLIM (Faithful Library about Internet Message).
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2, or (at
;; your option) any later version.
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;; 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., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'mime-def)
(defvar base64-dl-handle
(and (stringp base64-dl-module)
(file-exists-p base64-dl-module)
(dynamic-link base64-dl-module)))
(dynamic-call "emacs_base64_init" base64-dl-handle)
;; base64-dl-module provides `encode-base64-string' and `decode-base64-string'.
(defalias 'base64-encode-string 'encode-base64-string)
(defalias 'base64-decode-string 'decode-base64-string)
(defun base64-encode-region (start end)
"Encode current region by base64.
START and END are buffer positions."
(interactive "*r")
(insert
(prog1
(base64-encode-string
(buffer-substring start end))
(delete-region start end)))
(or (bolp) (insert ?\n)))
(defun base64-decode-region (start end)
"Decode current region by base64.
START and END are buffer positions."
(interactive "*r")
(insert
(prog1
(base64-decode-string
(buffer-substring start end))
(delete-region start end))))
(mel-define-method-function (mime-encode-string string (nil "base64"))
'base64-encode-string)
(mel-define-method-function (mime-decode-string string (nil "base64"))
'base64-decode-string)
(mel-define-method-function (mime-encode-region start end (nil "base64"))
'base64-encode-region)
(mel-define-method-function (mime-decode-region start end (nil "base64"))
'base64-decode-region)
(mel-define-method-function (encoded-text-encode-string string (nil "B"))
'base64-encode-string)
(mel-define-method encoded-text-decode-string (string (nil "B"))
(if (string-match (eval-when-compile
(concat "\\`" B-encoded-text-regexp "\\'"))
string)
(base64-decode-string string)
(error "Invalid encoded-text %s" string)))
;;; @ base64 encoder/decoder for file
;;;
(mel-define-method mime-insert-encoded-file (filename (nil "base64"))
"Encode contents of file FILENAME to base64, and insert the result.
It calls external base64 encoder specified by
`base64-external-encoder'. So you must install the program (maybe
mmencode included in metamail or XEmacs package)."
(interactive "*fInsert encoded file: ")
(insert (base64-encode-string
(with-temp-buffer
(set-buffer-multibyte nil)
(insert-file-contents-as-binary filename)
(buffer-string))))
(or (bolp) (insert ?\n)))
;; (mel-define-method mime-write-decoded-region (start end filename
;; (nil "base64"))
;; "Decode and write current region encoded by base64 into FILENAME.
;; START and END are buffer positions."
;; (interactive "*r\nFWrite decoded region to file: ")
;; (let ((str (buffer-substring start end)))
;; (with-temp-buffer
;; (insert (base64-decode-string str))
;; (write-region-as-binary (point-min)(point-max) filename))))
;;; @ end
;;;
(provide 'mel-b-dl)
;;; mel-b-dl.el ends here.
|