changeset 50281:33ca9e7e717a

Add dns-lookup-program wrapper
author Peter Breton <pbreton@attbi.com>
date Sun, 23 Mar 2003 13:36:32 +0000
parents 1a5341fe785b
children 369741bbc419
files lisp/net/net-utils.el
diffstat 1 files changed, 36 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/net/net-utils.el	Sun Mar 23 11:38:55 2003 +0000
+++ b/lisp/net/net-utils.el	Sun Mar 23 13:36:32 2003 +0000
@@ -205,6 +205,18 @@
   :group 'net-utils
   :type  'regexp)
 
+(defcustom dns-lookup-program  "host"
+  "Program to interactively query DNS information."
+  :group 'net-utils
+  :type  'string
+  )
+
+(defcustom dns-lookup-program-options  nil
+  "List of options to pass to the dns-lookup program."
+  :group 'net-utils
+  :type  '(repeat string)
+  )
+
 ;; Internal variables
 (defvar network-connection-service nil)
 (defvar network-connection-host    nil)
@@ -429,6 +441,25 @@
 (define-key nslookup-mode-map "\t" 'comint-dynamic-complete)
 
 ;;;###autoload
+(defun dns-lookup-host (host)
+  "Lookup the DNS information for HOST (name or IP address)."
+  (interactive
+   (list (read-from-minibuffer "Lookup host: " (net-utils-machine-at-point))))
+  (let ((options
+	 (if dns-lookup-program-options
+	     (append dns-lookup-program-options (list host))
+	   (list host))))
+    (net-utils-run-program
+     (concat "DNS Lookup [" host "]")
+     (concat "** "
+      (mapconcat 'identity
+		(list "DNS Lookup" host dns-lookup-program)
+		" ** "))
+     dns-lookup-program
+     options
+     )))
+
+;;;###autoload
 (defun dig (host)
   "Run dig program."
   (interactive
@@ -622,10 +653,11 @@
 	 (process-name (concat "Finger [" user-and-host "]"))
 	 (regexps finger-X.500-host-regexps)
 	 found)
-    (while (and regexps (not (string-match (car regexps) host)))
-      (setq regexps (cdr regexps)))
-    (when regexps
-      (setq user-and-host user))
+    (and regexps
+	 (while (not (string-match (car regexps) host))
+	   (setq regexps (cdr regexps)))
+	 (when regexps
+	   (setq user-and-host user)))
     (run-network-program
      process-name
      host