Function: netrc-machine
netrc-machine is a byte-compiled function defined in netrc.el.gz.
Signature
(netrc-machine LIST MACHINE &optional PORT DEFAULTPORT)
Documentation
Return the netrc values from LIST for MACHINE or for the default entry.
If PORT specified, only return entries with matching port tokens. Entries without port tokens default to DEFAULTPORT.
Source Code
;; Defined in /usr/src/emacs/lisp/net/netrc.el.gz
(defun netrc-machine (list machine &optional port defaultport)
"Return the netrc values from LIST for MACHINE or for the default entry.
If PORT specified, only return entries with matching port tokens.
Entries without port tokens default to DEFAULTPORT."
(let ((rest list)
result)
(while list
(when (equal (cdr (assoc "machine" (car list))) machine)
(push (car list) result))
(pop list))
(unless result
;; No machine name matches, so we look for default entries.
(while rest
(when (assoc "default" (car rest))
(let ((elem (car rest)))
(setq elem (delete (assoc "default" elem) elem))
(push elem result)))
(pop rest)))
(when result
(setq result (nreverse result))
(if (not port)
(car result)
(while (and result
(not (netrc-port-equal
(or port defaultport "nntp")
;; when port is not given in the netrc file,
;; it should mean "any port"
(or (netrc-get (car result) "port")
defaultport port))))
(pop result))
(car result)))))