annotate lisp/efs/efs-vos.el @ 199:169c0442b401 r20-3b26

Import from CVS: tag r20-3b26
author cvs
date Mon, 13 Aug 2007 10:00:33 +0200
parents 8b8b7f3559a2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
1 ;; -*-Emacs-Lisp-*-
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
3 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
4 ;; File: efs-vos.el
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
5 ;; Description: VOS support for efs
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
6 ;; Release: $efs release: 1.15 $
42
8b8b7f3559a2 Import from CVS: tag r19-15b104
cvs
parents: 22
diff changeset
7 ;; Version: #Revision: 1.1 $
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
8 ;; RCS:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
9 ;; Author: Sandy Rutherford <sandy@ibm550.sissa.it>
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
10 ;; Created: Sat Apr 3 03:05:00 1993 by sandy on ibm550
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
11 ;; Modified: Sun Nov 27 18:45:24 1994 by sandy on gandalf
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
12 ;; Language: Emacs-Lisp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
13 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
14 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
15
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
16 ;;; This file is part of efs. See efs.el for copyright
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
17 ;;; (it's copylefted) and warrranty (there isn't one) information.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
18
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
19 ;;; The original ange-ftp VOS support was written by Joe Wells <jbw@cs.bu.edu>
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
20
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
21 ;;; Thank you to Jim Franklin <jimf%shared@uunet.uu.net> for providing
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
22 ;;; information on the VOS operating system.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
23
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
24 (provide 'efs-vos)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
25 (require 'efs)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
26
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
27 (defconst efs-vos-version
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
28 (concat (substring "$efs release: 1.15 $" 14 -2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
29 "/"
42
8b8b7f3559a2 Import from CVS: tag r19-15b104
cvs
parents: 22
diff changeset
30 (substring "#Revision: 1.1 $" 11 -2)))
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
31
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
32 ;;;;---------------------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
33 ;;;; VOS support for efs
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
34 ;;;;---------------------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
35
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
36 ;;; A legal VOS pathname is of the form:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
37 ;;; %systemname#diskname>dirname>dirname>dir-or-filename
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
38 ;;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
39 ;;; Each of systemname, diskname, dirname, dir-or-filename can be
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
40 ;;; at most 32 characters.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
41 ;;; Valid characters are all alpha, upper and lower case, all digits,
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
42 ;;; plus: @[]\^`{|}~"$+,-./:_
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
43 ;;; restrictions: name cannot begin with hyphen (-) or period (.)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
44 ;;; name must not end with a period (.)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
45 ;;; name must not contain two adjacent periods (.)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
46 ;;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
47 ;;; Invalid characters are:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
48 ;;; non-printing control characters
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
49 ;;; SPACE and DEL
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
50 ;;; !#%&'()*;<=>?
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
51 ;;; all other ascii chars
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
52 ;;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
53 ;;; The full pathname must be less than or equal to 256 characters.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
54 ;;; VOS pathnames are CASE-SENSITIVE.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
55 ;;; The may be a directory depth limitation of 10 (newer versions may have
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
56 ;;; eliminated this).
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
57
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
58 ;;; entry points
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
59
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
60 (efs-defun efs-fix-path vos (path &optional reverse)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
61 ;; Convert PATH from UNIX-ish to VOS.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
62 ;; If REVERSE given then convert from VOS to UNIX-ish.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
63 ;; Does crude checking for valid path syntax, but is by no means exhaustive.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
64 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
65 (if reverse
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
66 (if (string-match "^\\(\\(%[^#>%]+\\)?#[^>#%]+\\)?>[^>#%]" path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
67 (let ((marker (1- (match-end 0)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
68 (result "/")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
69 system drive)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
70 (if (match-beginning 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
71 (if (match-beginning 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
72 (setq system (substring path 1 (match-end 2))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
73 drive (substring path (1+ (match-end 2))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
74 (match-end 1)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
75 (setq drive (substring 1 (match-end 1)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
76 (while (string-match ">" path marker)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
77 (setq result (concat result
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
78 (substring path marker
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
79 (match-beginning 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
80 "/")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
81 marker (match-end 0)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
82 (if drive
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
83 (if system
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
84 (concat "/" system "/" drive result
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
85 (substring path marker))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
86 (concat "/" drive result (substring path marker)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
87 (concat result (substring path marker))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
88 (error "Invalid VOS pathname %s" path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
89 (if (string-match "^/\\([^/]+\\)/\\([^/]+\\)/[^/]" path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
90 (let ((marker (1- (match-end 0)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
91 (result (concat "%"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
92 (substring path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
93 (match-beginning 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
94 (match-end 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
95 "#"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
96 (substring path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
97 (match-beginning 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
98 (match-end 2))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
99 ">")))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
100 ;; I'm guessing that VOS doesn't have a directory syntax.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
101 (setq path (efs-internal-directory-file-name path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
102 (while (string-match "/" path marker)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
103 (setq result
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
104 (concat result
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
105 (substring path marker
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
106 (match-beginning 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
107 ">")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
108 marker (match-end 0)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
109 (concat result (substring path marker)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
110 (error "Cannot convert path %s to VOS." path)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
111
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
112 (efs-defun efs-fix-dir-path vos (dir-path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
113 ;; Convert path from UNIX-ish to VMS ready for a DIRectory listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
114 (cond ((string-equal dir-path "/")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
115 (error "Cannot gork VOS system names"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
116 ((string-match "^/[^/]/$" dir-path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
117 (error "Cannot grok VOS devices"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
118 ((efs-fix-path 'vos dir-path))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
119
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
120 (defconst efs-vos-date-and-time-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
121 (concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
122 "\\(^\\| \\)" ; For links, this must match at the beginning of the line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
123 "[678901][0-9]-[01][0-9]-[0-3][0-9] [012][0-9]:[0-6][0-9]:[0-6][0-9] "))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
124 ;; Regexp to match a VOS file line. The end of the regexp must correspond
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
125 ;; to the start of the filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
126
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
127 (defmacro efs-vos-parse-filename ()
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
128 ;; Return the VOS filename on the current line of a listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
129 ;; Assumes that the point is at the beginning of the line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
130 ;; Return nil if no filename is found.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
131 (` (let ((eol (save-excursion (end-of-line) (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
132 (and (re-search-forward efs-vos-date-and-time-regexp eol t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
133 (buffer-substring (point) eol)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
134
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
135 (efs-defun efs-parse-listing vos
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
136 (host user dir path &optional switches)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
137 ;; Parse the current buffer which is assumed to be in MultiNet FTP dir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
138 ;; format, and return a hashtable as the result. SWITCHES are never used,
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
139 ;; but they must be specified in the argument list for compatibility
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
140 ;; with the unix version of this function.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
141 ;; HOST = remote host name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
142 ;; USER = user name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
143 ;; DIR = directory in as a full remote path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
144 ;; PATH = directory in full efs path syntax
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
145 ;; SWITCHES = ls switches (not relevant here)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
146 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
147 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
148 (let (tbl file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
149 ;; Look file files.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
150 (if (search-forward "\nFiles: " nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
151 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
152 (setq tbl (efs-make-hashtable))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
153 (forward-line 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
154 (skip-chars-forward "\n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
155 (while (setq file (efs-vos-parse-filename))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
156 (efs-put-hash-entry file '(nil) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
157 (forward-line 1))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
158 ;; Look for directories.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
159 (if (search-forward "\nDirs: " nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
160 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
161 (or tbl (setq tbl (efs-make-hashtable)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
162 (forward-line 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
163 (skip-chars-forward "\n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
164 (while (setq file (efs-vos-parse-filename))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
165 (efs-put-hash-entry file '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
166 (forward-line 1))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
167 ;; Look for links
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
168 (if (search-forward "\nLinks: " nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
169 (let (link)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
170 (or tbl (setq tbl (efs-make-hashtable)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
171 (forward-line 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
172 (skip-chars-forward "\n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
173 (while (setq file (efs-vos-parse-filename))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
174 (if (string-match " -> \\([^ ]+\\)" file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
175 ;; VOS puts a trailing blank after the name of a symlink
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
176 ;; target. Go figure...
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
177 (setq link (substring file (match-beginning 1) (match-end 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
178 file (substring file 0 (match-beginning 0)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
179 (setq link "")) ; weird?
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
180 (efs-put-hash-entry file (list link) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
181 (forward-line 1))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
182 ;; This returns nil if no headings for files, dirs, or links
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
183 ;; are found. In this case, we're assuming that it isn't a valid
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
184 ;; listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
185 (if tbl
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
186 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
187 (efs-put-hash-entry "." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
188 (efs-put-hash-entry ".." '(t) tbl)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
189 tbl)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
190
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
191 (efs-defun efs-allow-child-lookup vos (host user dir file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
192 ;; Returns t if FILE in directory DIR could possibly be a subdir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
193 ;; according to its file-name syntax, and therefore a child listing should
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
194 ;; be attempted.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
195 ;; Directoried don't have a size.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
196 (string-match ": not a file\\.$"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
197 (cdr (efs-send-size host user (concat dir file)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
198
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
199 ;;; Tree Dired Support
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
200
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
201 (defconst efs-dired-vos-re-exe
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
202 "^. +e ")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
203
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
204 (or (assq 'vos efs-dired-re-exe-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
205 (setq efs-dired-re-exe-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
206 (cons (cons 'vos efs-dired-vos-re-exe)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
207 efs-dired-re-exe-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
208
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
209 (defconst efs-dired-vos-re-dir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
210 "^. +[nsm] +[0-9]+ +[678901][0-9]-")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
211
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
212 (or (assq 'vos efs-dired-re-dir-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
213 (setq efs-dired-re-dir-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
214 (cons (cons 'vos efs-dired-vos-re-dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
215 efs-dired-re-dir-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
216
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
217 (efs-defun efs-dired-manual-move-to-filename vos
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
218 (&optional raise-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
219 ;; In dired, move to the first char of filename on this line, where
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
220 ;; line can be delimited by either \r or \n.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
221 ;; Returns (point) or nil if raise-error is nil and there is no
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
222 ;; filename on this line. In the later case, leaves the point at the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
223 ;; beginning of the line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
224 ;; This version is for VOS.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
225 (or eol (setq eol (save-excursion (skip-chars-forward "^\r\n") (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
226 (let (case-fold-search)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
227 (if bol
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
228 (goto-char bol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
229 (skip-chars-backward "^\n\r"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
230 (if (re-search-forward efs-vos-date-and-time-regexp eol t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
231 (point)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
232 (and raise-error (error "No file on this line")))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
233
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
234 (efs-defun efs-dired-manual-move-to-end-of-filename vos
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
235 (&optional no-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
236 ;; Assumes point is at the beginning of filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
237 ;; So, it should be called only after (dired-move-to-filename t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
238 ;; On failure signals an error, or returns nil.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
239 ;; This is the VOS version.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
240 (let ((opoint (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
241 (and selective-display
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
242 (null no-error)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
243 (eq (char-after
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
244 (1- (or bol (save-excursion
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
245 (skip-chars-backward "^\r\n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
246 (point)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
247 ?\r)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
248 ;; File is hidden or omitted.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
249 (cond
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
250 ((dired-subdir-hidden-p (dired-current-directory))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
251 (error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
252 (substitute-command-keys
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
253 "File line is hidden. Type \\[dired-hide-subdir] to unhide.")))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
254 ((error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
255 (substitute-command-keys
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
256 "File line is omitted. Type \\[dired-omit-toggle] to un-omit."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
257 )))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
258 (skip-chars-forward "-a-zA-Z0-9@[]\\^`{|}~\"$+,./:_")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
259 (if (or (= opoint (point)) (not (memq (following-char) '(?\n ?\r ?\ ))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
260 (if no-error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
261 nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
262 (error "No file on this line"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
263 (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
264
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
265 (efs-defun efs-dired-fixup-listing vos (file path &optional switches wildcard)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
266 ;; VOS listing contain some empty lines, which is inconvenient for dired.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
267 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
268 (skip-chars-forward "\n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
269 (delete-region (point-min) (point))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
270 (while (search-forward "\n\n" nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
271 (forward-char -2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
272 (delete-char 1)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
273
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
274 (efs-defun efs-dired-ls-trim vos ()
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
275 ;; Trims VOS dir listings for single files, so that they are exactly one line
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
276 ;; long.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
277 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
278 (let (case-fold-search)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
279 (re-search-forward efs-vos-date-and-time-regexp))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
280 (beginning-of-line)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
281 (delete-region (point-min) (point))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
282 (forward-line 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
283 (delete-region (point) (point-max)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
284
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
285 ;;; end of efs-vos.el