Function: ange-ftp-vms-delete-file-entry

ange-ftp-vms-delete-file-entry is a byte-compiled function defined in ange-ftp.el.gz.

Signature

(ange-ftp-vms-delete-file-entry NAME &optional DIR-P)

Source Code

;; Defined in /usr/src/emacs/lisp/net/ange-ftp.el.gz
;; This version only deletes file entries which have
;; explicit version numbers, because that is all VMS allows.

;; Can the following two functions be speeded up using file
;; completion functions?

(defun ange-ftp-vms-delete-file-entry (name &optional dir-p)
  (if dir-p
      (ange-ftp-internal-delete-file-entry name t)
    (save-match-data
      (let ((file (ange-ftp-get-file-part name)))
	(if (string-match ";[0-9]+\\'" file)
	    ;; In VMS you can't delete a file without an explicit
	    ;; version number, or wild-card (e.g. FOO;*)
	    ;; For now, we give up on wildcards.
	    (let ((files (gethash (file-name-directory name)
				  ange-ftp-files-hashtable)))
	      (if files
		  (let* ((root (substring file 0
					  (match-beginning 0)))
			 (regexp (concat "^"
					 (regexp-quote root)
					 ";[0-9]+$"))
			 versions)
		    (remhash file files)
		    ;; Now we need to check if there are any
		    ;; versions left. If not, then delete the
		    ;; root entry.
		    (maphash
		     (lambda (key _val)
		       (and (string-match regexp key)
			    (setq versions t)))
		     files)
		    (or versions
			(remhash root files))))))))))