annotate lisp/efs/efs-mpe.el @ 102:a145efe76779 r20-1b3

Import from CVS: tag r20-1b3
author cvs
date Mon, 13 Aug 2007 09:15:49 +0200
parents 8fc7fe29b841
children 7e54bd776075 9f59509498e1
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-mpe.el
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
5 ;; Release: $efs release: 1.15 $
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
6 ;; Version: $Revision: 1.1 $
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
7 ;; RCS:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
8 ;; Description: MPE (HP3000) support for efs.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
9 ;; Author: (Corny de Souza) cdesouza@hpbbn.bbn.hp.com
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
10 ;; Created: Fri Jan 15 12:58:29 1993
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
11 ;; Modified: Sun Nov 27 18:36:13 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 ;;; Credits
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
20 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
21 ;; Sandy Rutherford for his help and advice.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
23 ;;; Usage
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
24 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
25 ;; For a general description of remote file access see efs.el.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
26 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
27 ;; MPE Specifics
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
28 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
29 ;; *) To make things easier (for me) MPE has been UNIXified so think UNIX
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
30 ;; and you stand a good chance of understanding everything.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
31 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
32 ;; *) Filename syntax is as follows
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
33 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
34 ;; /session,user.account,group@system:/account/group/file;buildparms
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
35 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
36 ;; the "session," and ",group" in the logon sequence are optional.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
37 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
38 ;; e.g. /CDSUSER.OSCAR@SYSTEM41:/OSCAR/CDSSRC/TST0000S
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
39 ;; will get the file TST0000S.CDSSRC.OSCAR
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
40 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
41 ;; The ";buildparms" is also optional. It should be used when creating
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
42 ;; files whos characteristics differ from the default system buildparms,
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
43 ;; described in the file FTPDOC.ARPA.SYS (at least it is on my system).
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
44 ;; Also see variable efs-mpe-default-buildparms.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
45 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
46 ;; e.g. REC=-256,,V,ASCII
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
47 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
48 ;; *) Password syntax is as follows
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
49 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
50 ;; userpass,accountpass,grouppass
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
51 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
52 ;; Leading commas cannot be omitted, trailing commas can.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
53 ;; e.g. USERPASS,ACCTPASS (no group password)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
54 ;; ,ACCTPASS (only account password)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
55 ;; USERPASS,,GRPPASS (no account password)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
56 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
57 ;; *) Do not use account name completion on large systems. See the variable
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
58 ;; efs-mpe-account-completion-confirm
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
59 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
60 ;; *) Do not use group name completion on large accounts. See the variable
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
61 ;; efs-mpe-group-completion-confirm
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
62 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
63 ;; *) The buffers FILE and FILE;BUILDPARMS both point to the same physical
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
64 ;; disc file.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
65 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
66 ;; *) When using filename completion you will usually be given the option
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
67 ;; between FILE and FILE;BUILDPARMS. Just ignore the FILE;BUILDPARMS
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
68 ;; bit.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
69 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
70 ;; *) WARNING ********* Two buffer for the same file ************ WARNING
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
71 ;; If you land up with two buffers FILE and FILE;BUILDPARMS for the same
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
72 ;; file kill the FILE;BUILDPARMS one. If however this is newwer than
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
73 ;; the FILE buffer (and you cannot live with a buffer called
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
74 ;; FILE;BUILDPARMS) save it kill both buffers and get the FILE buffer again.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
75 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
76 ;; *) When creating new files only create FILES. It is possible to create
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
77 ;; files as GROUPs and ACCOUNTs but don't!
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
78 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
79 ;;; To Do
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
80 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
81 ;; A lot of things are likely to change with MPE 4.5 and POSIX so I do not want
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
82 ;; to invest too much time in this now. I would rather wait until I can see
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
83 ;; what comes with POSIX.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
84 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
85 ;; Feel free to send bugs, suggestions for enhancements and enhancements
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
86 ;; to me cdesouza@hpbbn.bbn.hp.com. If I have TIME I will try to deal with
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
87 ;; them. Also I'm not a lisp programmer so keep it simple or put in plenty
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
88 ;; of comments.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
89 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
90 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
91 ;; *) Improve on the dired GROUP and ACCOUNT listings.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
92 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
93 ;; *) Add ".." to dired FILE and GROUP listings.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
94 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
95 ;; *) Support POSIX (need POSIX machine first though).
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
96 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
97 ;; *) Test ACCOUNT name completion and listings properly. I have the problem
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
98 ;; that the only systems available to me are large ( i.e. start a listf
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
99 ;; @.@.@,2 today and come back tomorrow), which makes
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
100 ;; it pretty hard for me to test.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
101 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
102
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
103 ;;; Code
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
104
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
105 (provide 'efs-mpe)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
106 (require 'efs)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
107
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
108 ;;; User Variables
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
109
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
110 (defvar efs-mpe-account-completion-confirm t
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
111 "*Set to non-nil will cause a prompt to be issued before attempting ACCOUNT
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
112 name completion. For ACCOUNT name completion a LISTF @.@.@,2 is required.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
113 This can take a very long time on large systems")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
114
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
115 (defvar efs-mpe-group-completion-confirm t
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
116 "*Set to non-nil will cause a prompt to be issued before attempting GROUP
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
117 name completion. For GROUP name completion a LISTF @.@.ACCOUNT,2 is required.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
118 This can take a very long time on large accounts")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
119
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
120 (defvar efs-mpe-default-buildparms ""
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
121 "*If set to non empty string used to override the system default buildparms.")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
122
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
123 ;;; Internal Variables
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
124
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
125 (defconst efs-mpe-version
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
126 (concat (substring "$efs release: 1.15 $" 14 -2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
127 "/"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
128 (substring "$Revision: 1.1 $" 11 -2)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
129
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
130 ;;; Support for build parameters
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
131
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
132 (defun efs-mpe-get-buildparms (path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
133 ;; Gets the mpe buildparms for PATH. PATH should be in efs syntax.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
134 (let ((files (efs-get-files-hashtable-entry (file-name-directory
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
135 (directory-file-name path)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
136 (if files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
137 (let* ((file (efs-get-file-part path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
138 (completion-ignore-case
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
139 (memq 'mpe efs-case-insensitive-host-types))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
140 (bpversions (all-completions (concat file ";") files)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
141 (cond
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
142 ((null bpversions)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
143 efs-mpe-default-buildparms)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
144 ((= (length bpversions) 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
145 (substring (car bpversions) (length file)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
146 (t
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
147 (error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
148 "efs-mpe: %s seems to have more than one set of buildparams."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
149 path))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
150 ;; return the default
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
151 efs-mpe-default-buildparms)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
152
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
153 (defun efs-mpe-fix-buildparms (buildparms host user path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
154 "Try to assign buildparms for the file being PUT"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
155 (or
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
156 ;; Buildparms specified with file use them.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
157 buildparms
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
158 (efs-mpe-get-buildparms (format efs-path-format-string user host path))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
159
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
160 ;;; entry points
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
161
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
162 (efs-defun efs-fix-path mpe (path &optional reverse)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
163 ;; Convert PATH from UNIX-ish to MPE. If REVERSE given then convert from
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
164 ;; MPE to UNIX-ish. N.B. Path does not contain HOST or USER part so the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
165 ;; dynamic variables HOST and USER are used.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
166 ;; Also uses the dynamic variable CMD0.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
167 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
168 (if reverse
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
169 ;; This is never used as we only convert PWD (see below) output in
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
170 ;; this direction. However I will leave this here should it be
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
171 ;; required in the future.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
172 (if (let ((case-fold-search t))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
173 (string-match
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
174 (concat "^\\([A-Z][A-Z0-9]*\\)" ; file
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
175 "\\(.[A-Z][A-Z0-9]*\\)" ; group
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
176 "\\(.[A-Z][A-Z0-9]*\\)$") ; account
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
177 path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
178 (let (file group account)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
179 (setq file (substring path 0 (match-end 1)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
180 (if (match-beginning 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
181 (setq group (substring
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
182 path (1+ (match-beginning 2)) (match-end 2))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
183 (if (match-beginning 3)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
184 (setq account (substring
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
185 path (1+ (match-beginning 3))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
186 (match-end 3))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
187 (concat (and account (concat "/" account "/"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
188 (and group (concat group "/"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
189 file))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
190 ;; handle PWD output
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
191 (if (let ((case-fold-search t))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
192 (string-match
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
193 (concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
194 "\\([A-Z][A-Z0-9]*\\)?" ; sessionname
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
195 ",[A-Z][A-Z0-9]*\.\\([A-Z][A-Z0-9]*\\)," ; username.account
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
196 "\\([A-Z][A-Z0-9]*\\)$") ; group
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
197 path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
198 (concat "/"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
199 (substring path (match-beginning 2) (match-end 2))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
200 "/"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
201 (substring path (match-beginning 3) (match-end 3))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
202 "/")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
203 (error "Invalid MPE (MPE->UNIX) filename: %s" path)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
204 (if (let ((case-fold-search t))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
205 (string-match
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
206 (concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
207 "^\\(/[A-Z][A-Z0-9]*/\\)" ; account
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
208 "\\([A-Z][A-Z0-9]*/\\)" ; group
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
209 "\\([A-Z][A-Z0-9]*\\)" ; file
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
210 "\\(;.*\\)?$") ; buildparms
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
211 path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
212 (let ((for-put (and (boundp 'cmd0) (eq cmd0 'put)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
213 file group account buildparms)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
214 (setq account (substring
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
215 path (1+ (match-beginning 1)) (1- (match-end 1))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
216 (setq group (substring
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
217 path (match-beginning 2) (1- (match-end 2))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
218 (setq file (substring path (match-beginning 3) (match-end 3)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
219 (if for-put
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
220 (setq buildparms
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
221 (efs-mpe-fix-buildparms
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
222 (and (match-beginning 4)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
223 (substring path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
224 (match-beginning 4) (match-end 4)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
225 host user path)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
226 (concat file
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
227 (and group (concat "." group ))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
228 (and account (concat "." account ))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
229 (and for-put buildparms)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
230 (error "Invalid MPE (UNIX->MPE) filename: *%s*" path)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
231
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
232 (efs-defun efs-fix-dir-path mpe (dir-path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
233 ;; Convert path from UNIX-ish to MPE ready for a DIRectory listing. MPE does
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
234 ;; not have directories as such. It does have GROUPS and ACCOUNTS, but the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
235 ;; DIR command does not let you list just ACCOUNTs on the system or just
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
236 ;; GROUPs in the ACCOUNT - no you always get everything downwards
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
237 ;; i.e. ACCOUNTs + GROUPs + FILEs or GROUPs + FILEs or just FILEs
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
238 ;; depending on the level.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
239 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
240 (message "Fixing listing %s ..." dir-path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
241 (cond
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
242 ;; Everything !?! might take a while.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
243 ((string-equal dir-path "/")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
244 (if efs-mpe-account-completion-confirm
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
245 (if (y-or-n-p "Continue with ACCOUNT name completion? ")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
246 "@.@.@"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
247 (error "Quit ACCOUNT name completion"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
248 "@.@.@"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
249 ;; specification starts with account
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
250 ((let ((case-fold-search t))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
251 (string-match
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
252 (concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
253 "^\\(/[A-Z][A-Z0-9]*/\\)" ; account
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
254 "\\([A-Z][A-Z0-9]*/\\)?" ; group
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
255 "\\([A-Z][A-Z0-9]*\\)?" ; file
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
256 "\\(;.*\\)?/?$") ; buildparms
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
257 dir-path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
258 (let (file group account)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
259 (setq account (substring dir-path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
260 (1+ (match-beginning 1)) (1- (match-end 1))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
261 (if (match-beginning 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
262 (setq group (substring dir-path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
263 (match-beginning 2) (1- (match-end 2))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
264 (if efs-mpe-group-completion-confirm
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
265 (if (y-or-n-p "Continue with GROUP name completion? ")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
266 (setq group "@")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
267 (error "Quit GROUP name completion"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
268 (setq group "@")))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
269 (if (match-beginning 3)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
270 ;;(setq file (substring dir-path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
271 ;; (match-beginning 3) (1- (match-end 3))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
272 ;; set the filename to something silly so that the DIR will fail
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
273 ;; and so force a DIR for the group instead. Either I've
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
274 ;; misunderstood something or you have to do it like this.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
275 (setq file "~!#&*")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
276 (setq file "@"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
277 (concat file "." group "." account)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
278 (t
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
279 (error "Invalid MPE (LISTF) filename: %s" dir-path)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
280
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
281 (defconst efs-mpe-acct-grp-line-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
282 "ACCOUNT= +\\([A-Z][A-Z0-9]*\\) +GROUP= +\\([A-Z][A-Z0-9]*\\)")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
283 (defconst efs-mpe-file-line-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
284 (concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
285 "\\*? +\\([A-Z0-9]*\\) +\\([0-9]+\\)"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
286 "\\([BW]\\) +\\([FV]\\)\\([AB]\\)\\([MCO]?\\) +\\([0-9]+\\)"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
287
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
288 (efs-defun efs-parse-listing mpe
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
289 (host user dir path &optional switches)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
290 ;; Parse the current buffer which is assumed to be in
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
291 ;; mpe ftp dir format.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
292 ;; HOST is the name of the remote host.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
293 ;; USER is the user name.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
294 ;; DIR is the directory as a full remote path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
295 ;; PATH is the directory in full efs-syntax
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
296 ;; SWITCHES are the switches passed to ls (not relevant for mpe)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
297 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
298 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
299 ;;Make sure this is a valid listing
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
300 (if (re-search-forward "ACCOUNT= +[A-Z]+ +GROUP=" nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
301 (let (acct-tbl grp-tbl file-tbl
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
302 account group file
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
303 acct-cur grp-cur)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
304 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
305 ;; Look for something that could be a filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
306 (while (re-search-forward "^[A-Z][A-Z0-9]*" nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
307 (goto-char (match-beginning 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
308 ;; Check to see if looking at an ACCOUNT= GROUP= line. Could
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
309 ;; be a continuation (cont). line or a change in account or group
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
310 (if (looking-at efs-mpe-acct-grp-line-regexp)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
311 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
312 (setq account (buffer-substring (match-beginning 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
313 (match-end 1)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
314 (setq group (buffer-substring (match-beginning 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
315 (match-end 2)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
316 ;;Check for change of account
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
317 (if (not (string-equal acct-cur account))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
318 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
319 ;;Create table for account names and fill with
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
320 ;; "." entry.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
321 (if (not acct-tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
322 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
323 (setq acct-tbl (efs-make-hashtable))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
324 (efs-put-hash-entry "." '(t) acct-tbl)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
325 (efs-put-hash-entry account '(t) acct-tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
326 ;;Store the current group table
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
327 (if grp-tbl
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
328 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
329 (efs-set-files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
330 (efs-replace-path-component
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
331 path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
332 (concat "/" acct-cur "/"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
333 grp-tbl )
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
334 (setq grp-tbl nil)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
335 ;;Check for change in group. Change in account is automatic
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
336 ;;change in group.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
337 (if (or (not (string-equal acct-cur account))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
338 (not (string-equal grp-cur group)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
339 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
340 ;;Create table for group names and fill with
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
341 ;; "." and ".." entries.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
342 (if (not grp-tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
343 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
344 (setq grp-tbl (efs-make-hashtable))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
345 (efs-put-hash-entry "." '(t) grp-tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
346 (efs-put-hash-entry ".." '(t) grp-tbl)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
347 (efs-put-hash-entry group '(t) grp-tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
348 ;;Store current file table
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
349 (if file-tbl
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
350 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
351 (efs-set-files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
352 (efs-replace-path-component
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
353 path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
354 (concat "/" acct-cur "/" grp-cur "/"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
355 file-tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
356 (setq file-tbl nil)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
357 ;;Set new grp-cur and acct-cur incase one or both chnaged.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
358 (setq grp-cur group acct-cur account)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
359 )
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
360 ;;Looking at either a file name, or the line
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
361 ;;"FILENAME CODE --....--LOGICAL.."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
362 ;;Save the possible filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
363 (setq file (buffer-substring (point)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
364 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
365 (skip-chars-forward "A-Z0-9")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
366 (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
367 ;;Make sure its a file name.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
368 ;;"\\*?" is for files in access.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
369 ;; File codes can be numeric as well! CdS
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
370 (if (looking-at efs-mpe-file-line-regexp)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
371 ;;Hack out the buildparms
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
372 (let* ((code (and
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
373 (/= (match-beginning 1) (match-end 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
374 (concat ";CODE="
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
375 (buffer-substring
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
376 (match-beginning 1) (match-end 1)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
377 (length (buffer-substring (match-beginning 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
378 (match-end 2)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
379 (eof (buffer-substring (match-beginning 7)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
380 (match-end 7)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
381 (bytes (* (string-to-int eof)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
382 (string-to-int length)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
383 (word-byte (buffer-substring (match-beginning 3)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
384 (match-end 3)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
385 (fix-var (buffer-substring (match-beginning 4)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
386 (match-end 4)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
387 (ascii-binary (buffer-substring (match-beginning 5)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
388 (match-end 5)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
389 (cir-msg (and (match-beginning 6)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
390 (buffer-substring (match-beginning 6)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
391 (match-end 6))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
392 (rec ";REC="))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
393 (if (string-equal word-byte "B")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
394 (setq rec (concat rec "-"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
395 (setq bytes (* 2 bytes)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
396 (setq rec (concat rec length ",," fix-var ","))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
397 (if (string-equal ascii-binary "A")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
398 (setq rec (concat rec "ASCII"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
399 (setq rec (concat rec "BINARY")))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
400 (cond ((string-equal cir-msg "M")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
401 (setq cir-msg ";MSG"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
402 ((string-equal cir-msg "O")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
403 (setq cir-msg ";CIR"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
404 (t
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
405 (setq cir-msg nil)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
406 (if (not file-tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
407 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
408 (setq file-tbl (efs-make-hashtable))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
409 (efs-put-hash-entry "." '(t) file-tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
410 (efs-put-hash-entry ".." '(t) file-tbl)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
411 (message "Adding... %s" file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
412 (efs-put-hash-entry file (list nil bytes) file-tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
413 (efs-put-hash-entry (concat file rec code cir-msg)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
414 (list nil bytes) file-tbl)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
415 ) ;if looking-at
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
416 (forward-line 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
417 );while
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
418 ;;Check at what level the listing was done and return the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
419 ;;corresponding table. System = acct-tbl, Account = grp-tbl,
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
420 ;;Group = file-tbl.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
421 (if (let ((case-fold-search t))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
422 (string-match
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
423 "\\(/\\)\\([A-Z0-9]+/\\)?\\([A-Z0-9]+/\\)?\\([A-Z0-9]+/\\)?"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
424 dir))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
425 ;;group level listing, just return table of files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
426 (if (or (match-beginning 3) (match-beginning 4))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
427 file-tbl
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
428 ;;account level listing, return table of groups but do not
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
429 ;;forget to store current table of files.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
430 (if (match-beginning 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
431 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
432 (if file-tbl
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
433 (efs-set-files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
434 (efs-replace-path-component
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
435 path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
436 (concat "/" acct-cur "/" grp-cur "/"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
437 file-tbl))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
438 grp-tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
439 ;;System level listing, return table of accounts but do not
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
440 ;;forget to store current table of groups and files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
441 (if (match-beginning 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
442 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
443 (if file-tbl
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
444 (efs-set-files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
445 (efs-replace-path-component
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
446 path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
447 (concat "/" acct-cur "/" grp-cur "/"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
448 file-tbl))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
449 (if grp-tbl
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
450 (efs-set-files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
451 (efs-replace-path-component
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
452 path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
453 (concat "/" acct-cur "/"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
454 grp-tbl))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
455 acct-tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
456 (error "Parse listing 0 path %s" path))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
457 (error "Parse listing 1 path %s" path))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
458
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
459
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
460 (efs-defun efs-really-file-p mpe (file ent)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
461 ;; Doesn't treat the buildparm entry as a real file entry.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
462 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
463 (not (string-match ";" file))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
464
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
465 (efs-defun efs-delete-file-entry mpe (path &optional dir-p)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
466 ;; Deletes FILE and FILE;BUILDPARMS from file hashtable.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
467 (let ((ignore-case (memq 'mpe efs-case-insensitive-host-types)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
468 (if dir-p
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
469 (let ((path (file-name-as-directory path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
470 files)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
471 (efs-del-hash-entry path efs-files-hashtable ignore-case)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
472 (setq path (directory-file-name path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
473 files (efs-get-files-hashtable-entry
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
474 (file-name-directory path)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
475 (if files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
476 (efs-del-hash-entry (efs-get-file-part path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
477 files ignore-case)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
478 (let ((file (efs-get-file-part path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
479 (files (efs-get-files-hashtable-entry
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
480 (file-name-directory path))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
481 (if files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
482 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
483 (if (string-match ";" file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
484 (let ((root (substring file (match-beginning 0))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
485 ;; delete ROOT from hashtable
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
486 (efs-del-hash-entry root files ignore-case)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
487 ;; delete ROOT;BUILDPARAMS from hashtable
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
488 (efs-del-hash-entry file files ignore-case))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
489 ;; we've specified only a root.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
490 (let* ((root (concat file ";"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
491 (completion-ignore-case ignore-case)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
492 (extensions (all-completions root files)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
493 ;; Get rid of FILE.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
494 (efs-del-hash-entry file files ignore-case)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
495 ;; Get rid of all BUILDPARAMS versions
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
496 (while extensions
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
497 ;; all-completions will return names with the right case.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
498 ;; Don't need to ignore-case now.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
499 (efs-del-hash-entry (car extensions) files)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
500 (setq extensions (cdr extensions)))))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
501 (efs-del-from-ls-cache path t ignore-case)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
502
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
503 (efs-defun efs-add-file-entry mpe (path dir-p size owner
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
504 &optional modes nlinks mdtm)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
505 ;; Deletes FILE (if present) and FILE;BUILDPARMS (if present) from hashtable
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
506 ;; then adds FILE and FILE;BUILDPARMS (if specified) to hashtable.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
507 (let ((ignore-case (memq 'mpe efs-case-insensitive-host-types))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
508 (ent (let ((dir-p (null (null dir-p))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
509 (if mdtm
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
510 (list dir-p size owner nil nil mdtm)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
511 (list dir-p size owner)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
512
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
513 (if dir-p
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
514 (let* ((path (directory-file-name path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
515 (files (efs-get-files-hashtable-entry
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
516 (file-name-directory path))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
517 (if files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
518 (efs-put-hash-entry (efs-get-file-part path) ent files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
519 ignore-case)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
520
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
521 (let ((files (efs-get-files-hashtable-entry
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
522 (file-name-directory path))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
523 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
524 (if files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
525 (let* ((file (efs-get-file-part path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
526 (root (substring file 0 (string-match ";" file))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
527 (if (equal root file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
528 (setq file (concat file (efs-mpe-get-buildparms path))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
529 ;; In case there is another entry with different buildparams,
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
530 ;; wipe it.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
531 (efs-delete-file-entry 'mpe path nil)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
532 (efs-put-hash-entry root ent files ignore-case)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
533 (efs-put-hash-entry file ent files ignore-case))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
534 (efs-del-from-ls-cache path t ignore-case)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
535
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
536 (efs-defun efs-allow-child-lookup mpe (host user dir file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
537 ;; Returns non-NIL if FILE in directory DIR could possibly be a subdir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
538 ;; according to its file-name syntax, and therefore a child listing should
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
539 ;; be attempted. Note that DIR is in directory syntax i.e. /foo/bar/, not
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
540 ;; /foo/bar.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
541
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
542 ;; Subdirs in MPE are accounts or groups.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
543 (string-match "^/\\([^/]+/\\)?$" dir))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
544
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
545 (efs-defun efs-file-type mpe (path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
546 ;; Returns whether to treat an efs file as a text file or not.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
547 (let ((buildparams (efs-mpe-get-buildparms path)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
548 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
549 (let ((case-fold-search t))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
550 (cond
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
551 ((string-match "BINARY" buildparams)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
552 '8-binary)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
553 (t
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
554 'text))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
555
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
556 ;;; Tree dired support:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
557
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
558 (efs-defun efs-dired-manual-move-to-filename mpe
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
559 (&optional raise-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
560 ;; In dired, move to first char of filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
561 ;; Returns position (point) or nil if no filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
562 ;; This is the MPE version.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
563 (or eol (setq eol (save-excursion (skip-chars-forward "^\n\r") (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
564 (let (case-fold-search)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
565 (if bol
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
566 (goto-char bol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
567 (skip-chars-backward "^\n\r"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
568 ;; The "\\|ACCOUNT=\\|GROUP=" bit is to take care of the hacked account and
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
569 ;; group dired listings.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
570 (if (looking-at
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
571 ". [A-Z][A-Z0-9]*\\*? +\\([A-Z]* +[0-9]+\\|ACCOUNT=\\|GROUP=\\)")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
572 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
573 (forward-char 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
574 (point))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
575 (and raise-error (error "No file on this line")))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
576
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
577 (efs-defun efs-dired-manual-move-to-end-of-filename mpe
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
578 (&optional no-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
579 ;; Assumes point is at beginning of filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
580 ;; So, it should be called only after (dired-move-to-filename t).
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
581 ;; On failure, signals an error or returns nil.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
582 ;; This is the MPE version.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
583 (let ((opoint (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
584 (and selective-display
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
585 (null no-error)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
586 (eq (char-after
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
587 (1- (or bol (save-excursion
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
588 (skip-chars-backward "^\r\n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
589 (point)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
590 ?\r)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
591 ;; File is hidden or omitted.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
592 (cond
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
593 ((dired-subdir-hidden-p (dired-current-directory))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
594 (error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
595 (substitute-command-keys
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
596 "File line is hidden. Type \\[dired-hide-subdir] to unhide.")))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
597 ((error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
598 (substitute-command-keys
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
599 "File line is omitted. Type \\[dired-omit-toggle] to un-omit."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
600 )))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
601 (skip-chars-forward "A-Z0-9")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
602 (if (or (= opoint (point)) (not (memq (following-char) '(?\ ?*))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
603 (if no-error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
604 nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
605 (error "No file on this line"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
606 (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
607
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
608 (efs-defun efs-dired-ls-trim mpe ()
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
609 ;; trim single file listings 1-line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
610 ;; This uses an evil dynamical binding of file.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
611 (if (and (boundp 'file) (stringp file))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
612 (let ((f (file-name-nondirectory file)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
613 (or (zerop (length f))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
614 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
615 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
616 (if (search-forward (concat "\n" (upcase file) " ") nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
617 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
618 (beginning-of-line)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
619 (delete-region (point-min) (point))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
620 (forward-line 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
621 (delete-region (point) (point-max)))))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
622
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
623 (efs-defun efs-dired-fixup-listing mpe (file path &optional switches wildcard)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
624 ;; File (group) listings stay pretty much as they are group (account) and
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
625 ;; account (system) listings get realy hacked.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
626 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
627 (goto-char (point-max))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
628 (string-match
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
629 "\\(/\\)\\([A-Z0-9]+/\\)?\\([A-Z0-9]+/\\)?\\([A-Z0-9]+/\\)?"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
630 path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
631 ;; group or file level listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
632 (if (or (match-beginning 3) (match-beginning 4))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
633 ;; Hack out the continuation lines.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
634 (while
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
635 (re-search-backward
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
636 "\n\nACCOUNT=.+GROUP=.+(CONT\\.)\n\n.*\n.*\n" nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
637 (replace-match "" nil nil))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
638 ;;account level listing, hack out everything apart from group names
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
639 (if (match-beginning 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
640 (let ((group nil)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
641 (grp-cur nil))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
642 (while
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
643 (re-search-backward
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
644 "GROUP= +\\([A-Z][A-Z0-9]*\\)\\(.\\|\n\\)*"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
645 nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
646 (setq group
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
647 (buffer-substring (match-beginning 1) (match-end 1)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
648 ;;Continuation header or new group
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
649 (if (string-equal grp-cur group)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
650 (replace-match "" nil nil)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
651 (replace-match (format "\n\n%-10sGROUP=" group) nil nil))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
652 (forward-line -1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
653 (setq grp-cur group)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
654 (narrow-to-region (point-min) (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
655 (widen)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
656 (goto-char (point-max))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
657 (insert "\n\n"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
658 ;;System level listing, hack out everything apart from account names
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
659 (if (match-beginning 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
660 (let (account acct-cur)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
661 (while
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
662 (re-search-backward
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
663 "^ACCOUNT= +\\([A-Z][A-Z0-9]*\\)\\(.\\|\n\\)*"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
664 nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
665 (setq account
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
666 (buffer-substring (match-beginning 1) (match-end 1)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
667 ;;Continuation header or new account
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
668 (if (string-equal acct-cur account)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
669 (replace-match "" nil nil)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
670 (replace-match (format "%-10sACCOUNT=" account) nil nil))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
671 (forward-line -1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
672 (setq acct-cur account)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
673 (narrow-to-region (point-min) (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
674 (widen)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
675 (goto-char (point-max))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
676 (insert "\n\n")))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
677
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
678 ;;; end of efs-mpe.el