Function: netrc-machine-user-or-password

netrc-machine-user-or-password is a byte-compiled function defined in netrc.el.gz.

Signature

(netrc-machine-user-or-password MODE AUTHINFO-FILE-OR-LIST MACHINES PORTS DEFAULTS)

Documentation

Get the user name or password according to MODE from AUTHINFO-FILE-OR-LIST.

Matches a machine from MACHINES and a port from PORTS, giving default ports DEFAULTS to netrc-machine.

MODE can be "login" or "password", suitable for passing to netrc-get.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/netrc.el.gz
(defun netrc-machine-user-or-password (mode authinfo-file-or-list machines ports defaults)
  "Get the user name or password according to MODE from AUTHINFO-FILE-OR-LIST.
Matches a machine from MACHINES and a port from PORTS, giving
default ports DEFAULTS to `netrc-machine'.

MODE can be \"login\" or \"password\", suitable for passing to
`netrc-get'."
  (let ((authinfo-list (if (stringp authinfo-file-or-list)
                           (with-suppressed-warnings ((obsolete netrc-parse))
			     (netrc-parse authinfo-file-or-list))
			 authinfo-file-or-list))
	(ports (or ports '(nil)))
	(defaults (or defaults '(nil)))
	info)
    (if (listp mode)
	(setq info
	      (mapcar
	       (lambda (mode-element)
		 (netrc-machine-user-or-password
		  mode-element
		  authinfo-list
		  machines
		  ports
		  defaults))
	       mode))
      (dolist (machine machines)
	(dolist (default defaults)
	  (dolist (port ports)
	    (let ((alist (netrc-machine authinfo-list machine port default)))
	      (setq info (or (netrc-get alist mode) info)))))))
    info))