Function: ange-ftp-get-pwd

ange-ftp-get-pwd is a byte-compiled function defined in ange-ftp.el.gz.

Signature

(ange-ftp-get-pwd HOST USER)

Documentation

Attempt to get the current working directory for the given HOST/USER pair.

Returns (DIR . LINE) where DIR is either the directory or nil if not found, and LINE is the relevant success or fail line from the FTP-client.

Source Code

;; Defined in /usr/src/emacs/lisp/net/ange-ftp.el.gz
(defun ange-ftp-get-pwd (host user)
  "Attempt to get the current working directory for the given HOST/USER pair.
Returns (DIR . LINE) where DIR is either the directory or nil if not found,
and LINE is the relevant success or fail line from the FTP-client."
  (let* ((result (ange-ftp-send-cmd host user '(pwd) "Getting PWD"))
	 (line (cdr result))
	 dir)
    (if (car result)
	(save-match-data
	  (and (or (string-match "\"\\([^\"]*\\)\"" line)
		   ;; Some clients cache the value and return it in
		   ;; this way without asking the server.  (Bug#15058)
		   (string-match "^Remote directory: \\(.*\\)" line)
		   (string-match " \\([^ ]+\\) " line))	; stone-age VMS servers!
	       (setq dir (match-string 1 line)))))
    (cons dir line)))