Function: ange-ftp-get-process
ange-ftp-get-process is a byte-compiled function defined in
ange-ftp.el.gz.
Signature
(ange-ftp-get-process HOST USER)
Documentation
Return an FTP subprocess connected to HOST and logged in as USER.
Create a new process if needed.
Source Code
;; Defined in /usr/src/emacs/lisp/net/ange-ftp.el.gz
(defun ange-ftp-get-process (host user)
"Return an FTP subprocess connected to HOST and logged in as USER.
Create a new process if needed."
(let* ((name (ange-ftp-ftp-process-buffer host user))
(proc (get-process name)))
(if (and proc (memq (process-status proc) '(run open)))
proc
;; If `non-essential' is non-nil, don't reopen a new connection. It
;; will be caught in Tramp.
(when non-essential
(throw 'non-essential 'non-essential))
;; Must delete dead process so that new process can reuse the name.
(if proc (delete-process proc))
(let ((pass (ange-ftp-quote-string
(ange-ftp-get-passwd host user)))
(account (ange-ftp-quote-string
(ange-ftp-get-account host user))))
;; grab a suitable process.
(setq proc (ange-ftp-start-process host user name))
;; login to FTP server.
(if (and (ange-ftp-use-smart-gateway-p host)
ange-ftp-gateway-host)
(ange-ftp-smart-login host user pass account proc)
(ange-ftp-normal-login host user pass account proc))
;; Tell client to send back hash-marks as progress. It isn't usually
;; fatal if this command fails.
(ange-ftp-guess-hash-mark-size proc)
;; Guess at the host type.
(ange-ftp-guess-host-type host user)
;; Turn passive mode on or off as requested.
(let* ((case-fold-search t)
(passive
(or (assoc-default host ange-ftp-passive-host-alist
'string-match)
(if ange-ftp-try-passive-mode "on"))))
(if passive
(ange-ftp-passive-mode proc passive)))
;; Run any user-specified hooks. Note that proc, host and user are
;; dynamically bound at this point.
(let ((ange-ftp-this-user user)
(ange-ftp-this-host host))
(run-hooks 'ange-ftp-process-startup-hook)))
proc)))