Efs hacking - patch 2

"OCallaghan, Timothy (ELS)" <T.OCallaghan-dUsxN/C1/n1Wk0Htik3J/[email protected]> Thu, 8 Jul 2004 11:01:26 +0100
Newsgroups gmane.emacs.efs.general
Message-ID <06372B4E0B1E7D4FAAD2B63276D8700205E24DC9@elsamsvexch01.elsevier.nl>
Well, it must be my lucky day. I've managed to fix the directory resolving
problem.
the \\'s returned as part of the NT/Unix path to be VMSized, were not being
converted.
I've also changed the 'cannot look at root directory on device'
misconception.

efs now unmangled for VMS file editing. dired did give me this error when i
tested rename though:
(1) (error/warning) Error in process filter: (wrong-number-of-arguments
(lambda (path dir-p size owner &optional modes nlinks mdtm) (let
((ignore-case (memq (quote vms) efs-case-insensitive-host-types)) (ent (let
((dir-p (null (null dir-p)))) (if mdtm (list dir-p size owner nil nil mdtm)
(list dir-p size owner))))) (if dir-p (let* ((path (directory-file-name
path)) (files (efs-get-hash-entry (file-name-directory path)
efs-files-hashtable ignore-case))) (if files (efs-put-hash-entry
(efs-get-file-part path) ent files ignore-case))) (let ((files
(efs-get-hash-entry (file-name-directory path) efs-files-hashtable
ignore-case))) (if files (let ((file (efs-get-file-part path)))
(efs-save-match-data (or (string-match ^[^;]*\. file) (if (string-match ;
file) (setq file (concat (substring file 0 (match-beginning 0)) .;
(substring file (match-end 0)))) (setq file (concat file .)))) (if
(string-match ;[0-9]+$ file) (efs-put-hash-entry (substring file 0
(match-beginning 0)) ent files ignore-case) (let* ((completion-ignore-case
ignore-case) (len (length file)) (versions (all-completions file files
(function (lambda (sym) (string-match ;[0-9]+$ (symbol-name sym) len))))) (N
(1+ len)) (max (apply (quote max) (cons 0 (mapcar (function (lambda (x)
(string-to-int (substring x N)))) versions))))) (efs-put-hash-entry (concat
file ; (int-to-string (1+ max))) ent files)))) (efs-put-hash-entry file ent
files ignore-case))))) (efs-del-from-ls-cache path t ignore-case))) 2)


But I'll leave that for another day, or more likely, for someone competent
to fix.

This patch is against the NT Xemacs release package of efs:
;; File:         efs-vms.el
;; Release:      $efs release: 1.22 $
;; Version:      #Revision: 1.13 $

ta,

Tim.

----------------
***************
*** 146,154 ****
              (if (<= len 0)
                  (setq dir nil)
                (while (<= n len)
!                 (and (or (char-equal (aref dir n) ?/)
!                            (char-equal (aref dir n) ?\\)
!                            )
                       (cond
                        ((zerop n) (aset dir n ?\[))
                        ((= n len) (aset dir n ?\]))
--- 146,152 ----
              (if (<= len 0)
                  (setq dir nil)
                (while (<= n len)
!                 (and (char-equal (aref dir n) ?/)
                       (cond
                        ((zerop n) (aset dir n ?\[))
                        ((= n len) (aset dir n ?\]))
***************
*** 156,165 ****
                  (setq n (1+ n))))))
        (concat drive dir file)))))

! ;; in vms the paths "/" and "/DEV:/" correspond to [000000] and
dev:[000000]
! ;; though you may not have permissions for these directories, if you do,
! ;; then it mans you can explore the directory tree, rather than guess
! ;; subdirectory names

  (efs-defun efs-fix-dir-path vms (dir-path)
    ;; Convert path from UNIX-ish to VMS ready for a DIRectory listing.
--- 154,165 ----
                  (setq n (1+ n))))))
        (concat drive dir file)))))

! ;; It is important that this function barf for directories for which we
know
! ;; that we cannot possibly get a directory listing, such as "/" and
"/DEV:/".
! ;; This is because it saves an unnecessary FTP error, or possibly the
listing
! ;; might succeed, but give erroneous info. This last case is particularly
! ;; likely for OS's (like MTS) for which we need to use a wildcard in order
! ;; to list a directory.

  (efs-defun efs-fix-dir-path vms (dir-path)
    ;; Convert path from UNIX-ish to VMS ready for a DIRectory listing.
***************
*** 167,178 ****
    ;; think so, because expand-filename should have already short-circuited
    ;; them.
    (cond ((string-equal dir-path "/")
!        (efs-fix-path 'vms "/000000/"))
!       ((string-match "^\\(/[-A-Z0-9_$]+:/\\)$" dir-path)
!        (efs-fix-path 'vms (concat dir-path "000000/")))
        ((efs-fix-path 'vms dir-path))))
! ;
!
  ;; These parsing functions are as general as possible because the syntax
  ;; of ftp listings from VMS hosts is a bit erratic. What saves us is that
  ;; the VMS filename syntax is so rigid. If they bomb on a listing in the
--- 167,177 ----
    ;; think so, because expand-filename should have already short-circuited
    ;; them.
    (cond ((string-equal dir-path "/")
!        (error "Cannot get listing for fictitious \"/\" directory."))
!       ((string-match "^/[-A-Z0-9_$]+:/$" dir-path)
!        (error "Cannot get listing for device."))
        ((efs-fix-path 'vms dir-path))))
!
  ;; These parsing functions are as general as possible because the syntax
  ;; of ftp listings from VMS hosts is a bit erratic. What saves us is that
  ;; the VMS filename syntax is so rigid. If they bomb on a listing in the