Function: ange-ftp-fix-name-for-bs2000
ange-ftp-fix-name-for-bs2000 is a byte-compiled function defined in
ange-ftp.el.gz.
Signature
(ange-ftp-fix-name-for-bs2000 NAME &optional REVERSE)
Source Code
;; Defined in /usr/src/emacs/lisp/net/ange-ftp.el.gz
;; Convert NAME from UNIX-ish to BS2000. If REVERSE given then convert from
;; BS2000 to UNIX-ish.
(defun ange-ftp-fix-name-for-bs2000 (name &optional reverse)
(save-match-data
(if reverse
(if (string-match
ange-ftp-bs2000-fix-name-regexp-reverse
name)
(let ((pubset (if (match-beginning 1)
(substring name 0 (match-end 1))))
(userid (if (match-beginning 2)
(substring name
(match-beginning 2)
(1- (match-end 2)))))
(filename (if (match-beginning 3)
(substring name (match-beginning 3)))))
(concat
"/"
;; we have to insert "_/" here to prevent expand-file-name to
;; interpret BS2000 pubsets as the special escape prefix:
(and pubset (concat "_/" pubset "/"))
(and userid (concat userid "/"))
filename))
(error "Name %s didn't match" name))
;; and here we (maybe) have to remove the inserted "_/" 'cause
;; of our prevention of the special escape prefix above:
(if (string-match (concat "^/_/") name)
(setq name (substring name 2)))
(if (string-match
ange-ftp-bs2000-fix-name-regexp
name)
(let ((pubset (if (match-beginning 1)
(substring name
(match-beginning 1)
(1- (match-end 1)))))
(userid (if (match-beginning 2)
(substring name
(match-beginning 2)
(1- (match-end 2)))))
(filename (if (match-beginning 3)
(substring name (match-beginning 3)))))
(if (and (stringp filename)
(string-match "[#@].+" filename))
(setq filename (concat ange-ftp-bs2000-special-prefix
(substring filename 1))))
(upcase
(concat
pubset
(and userid (concat userid "."))
;; change every '/' in filename to a '.', normally not necessary
(and filename
(subst-char-in-string ?/ ?. filename)))))
;; Let's hope that BS2000 recognize this anyway:
name))))