Mercurial > emacs
comparison lisp/net/net-utils.el @ 50281:33ca9e7e717a
Add dns-lookup-program wrapper
author | Peter Breton <pbreton@attbi.com> |
---|---|
date | Sun, 23 Mar 2003 13:36:32 +0000 |
parents | c4fdc37d21f5 |
children | 695cf19ef79e |
comparison
equal
deleted
inserted
replaced
50280:1a5341fe785b | 50281:33ca9e7e717a |
---|---|
202 | 202 |
203 This variable is only used if the variable | 203 This variable is only used if the variable |
204 `comint-use-prompt-regexp-instead-of-fields' is non-nil." | 204 `comint-use-prompt-regexp-instead-of-fields' is non-nil." |
205 :group 'net-utils | 205 :group 'net-utils |
206 :type 'regexp) | 206 :type 'regexp) |
207 | |
208 (defcustom dns-lookup-program "host" | |
209 "Program to interactively query DNS information." | |
210 :group 'net-utils | |
211 :type 'string | |
212 ) | |
213 | |
214 (defcustom dns-lookup-program-options nil | |
215 "List of options to pass to the dns-lookup program." | |
216 :group 'net-utils | |
217 :type '(repeat string) | |
218 ) | |
207 | 219 |
208 ;; Internal variables | 220 ;; Internal variables |
209 (defvar network-connection-service nil) | 221 (defvar network-connection-service nil) |
210 (defvar network-connection-host nil) | 222 (defvar network-connection-host nil) |
211 | 223 |
425 '((nslookup-font-lock-keywords))) | 437 '((nslookup-font-lock-keywords))) |
426 (setq comint-prompt-regexp nslookup-prompt-regexp) | 438 (setq comint-prompt-regexp nslookup-prompt-regexp) |
427 (setq comint-input-autoexpand t)) | 439 (setq comint-input-autoexpand t)) |
428 | 440 |
429 (define-key nslookup-mode-map "\t" 'comint-dynamic-complete) | 441 (define-key nslookup-mode-map "\t" 'comint-dynamic-complete) |
442 | |
443 ;;;###autoload | |
444 (defun dns-lookup-host (host) | |
445 "Lookup the DNS information for HOST (name or IP address)." | |
446 (interactive | |
447 (list (read-from-minibuffer "Lookup host: " (net-utils-machine-at-point)))) | |
448 (let ((options | |
449 (if dns-lookup-program-options | |
450 (append dns-lookup-program-options (list host)) | |
451 (list host)))) | |
452 (net-utils-run-program | |
453 (concat "DNS Lookup [" host "]") | |
454 (concat "** " | |
455 (mapconcat 'identity | |
456 (list "DNS Lookup" host dns-lookup-program) | |
457 " ** ")) | |
458 dns-lookup-program | |
459 options | |
460 ))) | |
430 | 461 |
431 ;;;###autoload | 462 ;;;###autoload |
432 (defun dig (host) | 463 (defun dig (host) |
433 "Run dig program." | 464 "Run dig program." |
434 (interactive | 465 (interactive |
620 (net-utils-machine-at-point)))))) | 651 (net-utils-machine-at-point)))))) |
621 (let* ((user-and-host (concat user "@" host)) | 652 (let* ((user-and-host (concat user "@" host)) |
622 (process-name (concat "Finger [" user-and-host "]")) | 653 (process-name (concat "Finger [" user-and-host "]")) |
623 (regexps finger-X.500-host-regexps) | 654 (regexps finger-X.500-host-regexps) |
624 found) | 655 found) |
625 (while (and regexps (not (string-match (car regexps) host))) | 656 (and regexps |
626 (setq regexps (cdr regexps))) | 657 (while (not (string-match (car regexps) host)) |
627 (when regexps | 658 (setq regexps (cdr regexps))) |
628 (setq user-and-host user)) | 659 (when regexps |
660 (setq user-and-host user))) | |
629 (run-network-program | 661 (run-network-program |
630 process-name | 662 process-name |
631 host | 663 host |
632 (cdr (assoc 'finger network-connection-service-alist)) | 664 (cdr (assoc 'finger network-connection-service-alist)) |
633 user-and-host))) | 665 user-and-host))) |