Function: ange-ftp-parse-dired-listing

ange-ftp-parse-dired-listing is a byte-compiled function defined in ange-ftp.el.gz.

Signature

(ange-ftp-parse-dired-listing &optional SWITCHES)

Source Code

;; Defined in /usr/src/emacs/lisp/net/ange-ftp.el.gz
;; Parse the current buffer which is assumed to be in a dired-like listing
;; format, and return a hashtable as the result. If the listing is not really
;; a listing, then return nil.

(defun ange-ftp-parse-dired-listing (&optional switches)
  (save-match-data
    (cond
     ((looking-at "^total [0-9]+$")
      (forward-line 1)
      ;; Some systems put in a blank line here.
      (if (eolp) (forward-line 1))
      (ange-ftp-ls-parser switches))
     ((looking-at "[^\n]+\\( not found\\|: Not a directory\\)\n\\'")
      ;; It's an ls error message.
      nil)
     ((eobp) ; i.e. (zerop (buffer-size))
      ;; This could be one of:
      ;; (1) An Ultrix ls error message
      ;; (2) A listing with the A switch of an empty directory
      ;;     on a machine which doesn't give a total line.
      ;; (3) The twilight zone.
      ;; We'll assume (1) for now.
      nil)
     ((re-search-forward directory-listing-before-filename-regexp nil t)
      (beginning-of-line)
      (ange-ftp-ls-parser switches))
     ((re-search-forward "^[^ \n\t]+ +\\([0-9]+\\|-\\|=\\) " nil t)
      ;; It's a dl listing (I hope).
      ;; file is bound by the call to ange-ftp-ls
      (ange-ftp-add-dl-dir ange-ftp-this-file)
      (beginning-of-line)
      (ange-ftp-dl-parser))
     (t nil))))