Function: ange-ftp-get-host-with-passwd

ange-ftp-get-host-with-passwd is a byte-compiled function defined in ange-ftp.el.gz.

Signature

(ange-ftp-get-host-with-passwd USER)

Documentation

Given a USER, return a host we know the password for.

Source Code

;; Defined in /usr/src/emacs/lisp/net/ange-ftp.el.gz
(defun ange-ftp-get-host-with-passwd (user)
  "Given a USER, return a host we know the password for."
  (ange-ftp-parse-netrc)
  (catch 'found-one
    (maphash
     (lambda (host _val)
       (if (ange-ftp-lookup-passwd host user) (throw 'found-one host)))
     ange-ftp-user-hashtable)
    (save-match-data
      (maphash
       (lambda (key value)
	 (if (string-match "\\`[^/]*\\(/\\).*\\'" key)
	     (let ((host (substring key 0 (match-beginning 1))))
	       (if (and (string-equal user (substring key (match-end 1)))
			value)
		   (throw 'found-one host)))))
       ange-ftp-passwd-hashtable))
    nil))