comparison lisp/efs/efs-cu.el @ 114:8619ce7e4c50 r20-1b9

Import from CVS: tag r20-1b9
author cvs
date Mon, 13 Aug 2007 09:21:54 +0200
parents 4be1180a9e89
children 9f59509498e1
comparison
equal deleted inserted replaced
113:2ec2fe4a4c89 114:8619ce7e4c50
1 ;; -*-Emacs-Lisp-*- 1 ;; -*-Emacs-Lisp-*-
2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3 ;; 3 ;;
4 ;; File: efs-cu.el 4 ;; File: efs-cu.el
5 ;; Release: $efs release: 1.15 $ 5 ;; Release: $efs release: 1.15 $
6 ;; Version: $Revision: 1.3 $ 6 ;; Version: $Revision: 1.4 $
7 ;; RCS: 7 ;; RCS:
8 ;; Description: Common utilities needed by efs files. 8 ;; Description: Common utilities needed by efs files.
9 ;; Author: Sandy Rutherford <sandy@ibm550.sissa.it> 9 ;; Author: Sandy Rutherford <sandy@ibm550.sissa.it>
10 ;; Created: Fri Jan 28 19:55:45 1994 by sandy on ibm550 10 ;; Created: Fri Jan 28 19:55:45 1994 by sandy on ibm550
11 ;; Language: Emacs-Lisp 11 ;; Language: Emacs-Lisp
24 24
25 ;;;; ------------------------------------------------------------ 25 ;;;; ------------------------------------------------------------
26 ;;;; Use configuration variables. 26 ;;;; Use configuration variables.
27 ;;;; ------------------------------------------------------------ 27 ;;;; ------------------------------------------------------------
28 28
29 (defvar efs-default-user nil 29 (defvar efs-default-user "anonymous"
30 "*User name to use when none is specied in a pathname. 30 "*User name to use when none is specied in a pathname.
31 31
32 If a string, than this string is used as the default user name. 32 If a string, than this string is used as the default user name.
33 If nil, then the name under which the user is logged in is used. 33 If nil, then the name under which the user is logged in is used.
34 If t, then the user is prompted for a name. 34 If t, then the user is prompted for a name.
53 ;;;; ------------------------------------------------------------- 53 ;;;; -------------------------------------------------------------
54 54
55 (defconst efs-cu-version 55 (defconst efs-cu-version
56 (concat (substring "$efs release: 1.15 $" 14 -2) 56 (concat (substring "$efs release: 1.15 $" 14 -2)
57 "/" 57 "/"
58 (substring "$Revision: 1.3 $" 11 -2))) 58 (substring "$Revision: 1.4 $" 11 -2)))
59 59
60 (defconst efs-case-insensitive-host-types 60 (defconst efs-case-insensitive-host-types
61 '(vms cms mts ti-twenex ti-explorer dos mvs tops-20 mpe ka9q dos-distinct 61 '(vms cms mts ti-twenex ti-explorer dos mvs tops-20 mpe ka9q dos-distinct
62 os2 hell guardian ms-unix netware cms-knet nos-ve) 62 os2 hell guardian ms-unix netware cms-knet nos-ve)
63 "List of host types for which case is insignificant in file names.") 63 "List of host types for which case is insignificant in file names.")
84 84
85 (defvar efs-path-host-format 85 (defvar efs-path-host-format
86 (substring efs-path-user-at-host-format 3) 86 (substring efs-path-user-at-host-format 3)
87 "Format to return `host:' strings for completion in root directory.") 87 "Format to return `host:' strings for completion in root directory.")
88 88
89 ;;;###autoload
89 (defvar efs-path-root-regexp "^/[^/:]+:" 90 (defvar efs-path-root-regexp "^/[^/:]+:"
90 "Regexp to match the `/user@host:' root of an efs full path.") 91 "Regexp to match the `/user@host:' root of an efs full path.")
91 92
92 (defvar efs-path-root-short-circuit-regexp "//[^/:]+:") 93 (defvar efs-path-root-short-circuit-regexp "//[^/:]+:")
93 ;; Regexp to match an efs user@host root, which short-circuits 94 ;; Regexp to match an efs user@host root, which short-circuits
617 (setq efs-passwd-seed (+ 1 (random 255))))) 618 (setq efs-passwd-seed (+ 1 (random 255)))))
618 619
619 (defun efs-code-string (string) 620 (defun efs-code-string (string)
620 ;; Encode a string, using `efs-passwd-seed'. This is nil-potent, 621 ;; Encode a string, using `efs-passwd-seed'. This is nil-potent,
621 ;; meaning applying it twice decodes. 622 ;; meaning applying it twice decodes.
622 (if (and (fboundp 'int-char) (fboundp 'char-int)) 623 (if (and (fboundp 'int-to-char) (fboundp 'char-to-int))
623 (mapconcat 624 (mapconcat
624 (function 625 (function
625 (lambda (c) 626 (lambda (c)
626 (char-to-string 627 (char-to-string
627 (int-char (logxor (efs-get-passwd-seed) (char-int c)))))) 628 (int-to-char (logxor (efs-get-passwd-seed) (char-to-int c))))))
628 string "") 629 string "")
629 (mapconcat 630 (mapconcat
630 (function 631 (function
631 (lambda (c) 632 (lambda (c)
632 (char-to-string (logxor (efs-get-passwd-seed) c)))) 633 (char-to-string (logxor (efs-get-passwd-seed) c))))