Function: ange-ftp-nslookup-host

ange-ftp-nslookup-host is an interactive and byte-compiled function defined in ange-ftp.el.gz.

Signature

(ange-ftp-nslookup-host HOSTNAME)

Documentation

Attempt to resolve the given HOSTNAME using nslookup if possible.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/net/ange-ftp.el.gz
(defun ange-ftp-nslookup-host (hostname)
  "Attempt to resolve the given HOSTNAME using nslookup if possible."
  (interactive "sHost:  ")
  (if ange-ftp-nslookup-program
      (let ((default-directory
	      (if (ange-ftp-real-file-accessible-directory-p default-directory)
		  default-directory
		exec-directory))
	    ;; It would be nice to make process-connection-type nil,
	    ;; but that doesn't work: ftp never responds.
	    ;; Can anyone find a fix for that?
	    (proc (let ((process-connection-type t))
		    (start-process " *nslookup*" " *nslookup*"
				   ange-ftp-nslookup-program hostname)))
	    (res hostname))
	(set-process-query-on-exit-flag proc nil)
	(with-current-buffer (process-buffer proc)
	  (while (memq (process-status proc) '(run open))
	    (accept-process-output proc))
	  (goto-char (point-min))
	  (if (re-search-forward "Name:.*\nAddress: *\\(.*\\)$" nil t)
	      (setq res (match-string 1)))
	  (kill-buffer (current-buffer)))
	res)
    hostname))