(defun resolve-hostname (name)
"Resolve a hostname to an IP address using the DNS, or return nil."
#+cmu (let ((he (ext:lookup-host-entry name)))
- (and he
- (ext:host-entry-addr he)))
- #-cmu nil
-)
+ (and he (ext:host-entry-addr he)))
+ #+clisp (let ((he (ext:resolve-host-ipaddr name)))
+ (and he (string-ipaddr (car (ext:hostent-addr-list he)))))
+ #+ecl (nth-value 2 (ext:lookup-host-entry name))
+ #-(or cmu clisp ecl) nil)
(defun canonify-hostname (name)
"Resolve a hostname to canonical form using the DNS, or return nil."
#+cmu (let ((he (ext:lookup-host-entry name)))
- (and he
- (ext:host-entry-name he)))
- #-cmu nil)
+ (and he (ext:host-entry-name he)))
+ #+clisp (let ((he (ext:resolve-host-ipaddr name)))
+ (and he (ext:hostent-name he)))
+ #+ecl (nth-value 0 (ext:lookup-host-entry name))
+ #-(or cmu clisp ecl) name)
;;;--------------------------------------------------------------------------
;;; Host names and specifiers.