Mercurial > emacs
annotate lisp/net/tramp-uu.el @ 94099:20019cf19232
*** empty log message ***
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Tue, 15 Apr 2008 13:38:55 +0000 |
parents | 1e3a407766b9 |
children | 91e5880a36c1 |
rev | line source |
---|---|
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
1 ;;; tramp-uu.el --- uuencode in Lisp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
2 |
91490
7027f39ad5e2
*** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents:
87649
diff
changeset
|
3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, |
7027f39ad5e2
*** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents:
87649
diff
changeset
|
4 ;; 2008 Free Software Foundation, Inc. |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
5 |
93125
c10d57278d04
Fix up encoding.
Michael Albinus <michael.albinus@gmx.de>
parents:
93080
diff
changeset
|
6 ;; Author: Kai Großjohann <kai.grossjohann@gmx.net> |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
7 ;; Keywords: comm, terminals |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
8 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
9 ;; This file is free software; you can redistribute it and/or modify |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
10 ;; it under the terms of the GNU General Public License as published by |
78230
84cf1e2214c5
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
77986
diff
changeset
|
11 ;; the Free Software Foundation; either version 3, or (at your option) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
12 ;; any later version. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
13 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
14 ;; This file is distributed in the hope that it will be useful, |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
17 ;; GNU General Public License for more details. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
18 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
19 ;; You should have received a copy of the GNU General Public License |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
20 ;; along with GNU Emacs; see the file COPYING. If not, see |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
21 ;; <http://www.gnu.org/licenses/>. |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
22 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
23 ;;; Commentary: |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
24 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
25 ;; An implementation of "uuencode" in Lisp. Uses the function |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
26 ;; base64-encode-region which is built-in to modern Emacsen. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
27 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
28 ;;; Code: |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
29 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
30 (defvar tramp-uu-b64-alphabet |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
31 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
32 "Mapping from base64-encoded character to the byte it represents.") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
33 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
34 (defvar tramp-uu-b64-char-to-byte |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
35 (let ((i 0)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
36 (mapcar (lambda (c) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
37 (prog1 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
38 (cons c i) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
39 (setq i (1+ i)))) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
40 tramp-uu-b64-alphabet)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
41 "Alist of mapping from base64 character to its byte.") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
42 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
43 (defun tramp-uu-byte-to-uu-char (byte) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
44 "Return the character encoding BYTE." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
45 (if (zerop byte) ?` (+ byte 32))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
46 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
47 (defun tramp-uu-b64-char-to-byte (char) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
48 "Return the byte that is encoded as CHAR." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
49 (cdr (assq char tramp-uu-b64-char-to-byte))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
50 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
51 (defun tramp-uuencode-region (beg end) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
52 "UU-encode the region between BEG and END." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
53 ;; First we base64 encode the region, then we transmogrify that into |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
54 ;; uu encoding. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
55 (let ((len (base64-encode-region beg end t)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
56 (padding 0) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
57 i c) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
58 (save-excursion |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
59 (goto-char beg) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
60 (setq i 0) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
61 (while (< i len) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
62 (setq c (char-after (point))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
63 (delete-char 1) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
64 (if (equal c ?=) |
55844
4bc6cb45c326
Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents:
52401
diff
changeset
|
65 ;; "=" means padding. Insert "`" instead. Not counted for length. |
4bc6cb45c326
Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents:
52401
diff
changeset
|
66 (progn (insert "`") (setq len (1- len))) |
4bc6cb45c326
Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents:
52401
diff
changeset
|
67 (insert (tramp-uu-byte-to-uu-char (tramp-uu-b64-char-to-byte c))) |
4bc6cb45c326
Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents:
52401
diff
changeset
|
68 (setq i (1+ i))) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
69 ;; Every 60 characters, add "M" at beginning of line (as |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
70 ;; length byte) and insert a newline. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
71 (when (zerop (% i 60)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
72 (save-excursion |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
73 (beginning-of-line) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
74 (insert (char-to-string (+ 32 (/ (* 3 60) 4))))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
75 (insert "\n"))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
76 ;; If there is something leftover, we compute the length byte |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
77 ;; for that stuff and insert it and a trailing newline. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
78 (unless (zerop (% i 60)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
79 (save-excursion |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
80 (beginning-of-line) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
81 (insert (char-to-string (+ 32 (% (- end beg) 45))))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
82 (insert "\n")) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
83 ;; Why is there always a "`" line at the end? |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
84 (insert "`\nend\n") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
85 (goto-char beg) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
86 (insert "begin 600 xxx\n")))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
87 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
88 (provide 'tramp-uu) |
52401 | 89 |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93125
diff
changeset
|
90 ;; arch-tag: 7153f2c6-8be5-4cd2-8c06-0fbcf5190ef6 |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
91 ;;; tramp-uu.el ends here |
93080
d68797743640
* net/tramp-uu.el: Move coding cookie at the end.
Michael Albinus <michael.albinus@gmx.de>
parents:
91490
diff
changeset
|
92 |
d68797743640
* net/tramp-uu.el: Move coding cookie at the end.
Michael Albinus <michael.albinus@gmx.de>
parents:
91490
diff
changeset
|
93 ;; Local Variables: |
d68797743640
* net/tramp-uu.el: Move coding cookie at the end.
Michael Albinus <michael.albinus@gmx.de>
parents:
91490
diff
changeset
|
94 ;; mode: Emacs-Lisp |
d68797743640
* net/tramp-uu.el: Move coding cookie at the end.
Michael Albinus <michael.albinus@gmx.de>
parents:
91490
diff
changeset
|
95 ;; coding: utf-8 |
d68797743640
* net/tramp-uu.el: Move coding cookie at the end.
Michael Albinus <michael.albinus@gmx.de>
parents:
91490
diff
changeset
|
96 ;; End: |