aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1998-10-06 23:59:00 +0000
committerKarl Heuer1998-10-06 23:59:00 +0000
commitc1977112c35ee75e2a482fef462eb16e9f571943 (patch)
treef0f3fa2b8dd0fef4405921e46ddbd51058c24b9e
parent261f6363b53262d4667223af2170f54a2354309f (diff)
downloademacs-c1977112c35ee75e2a482fef462eb16e9f571943.tar.gz
emacs-c1977112c35ee75e2a482fef462eb16e9f571943.zip
(ftp, nslookup): Require comint.
(network-service-connection): Likewise. (whois-server-name): Defaults to whois.arin.net (whois-server-list, whois-server-tld, whois-guess-server): New var. (whois): Tries to guess the appropriate top-level domain server. (whois-get-tld): New function.
-rw-r--r--lisp/net-utils.el75
1 files changed, 67 insertions, 8 deletions
diff --git a/lisp/net-utils.el b/lisp/net-utils.el
index c4b3e8f8c63..32cdbf0d742 100644
--- a/lisp/net-utils.el
+++ b/lisp/net-utils.el
@@ -440,6 +440,7 @@ If your system's ping continues until interrupted, you can try setting
440(defun nslookup () 440(defun nslookup ()
441 "Run nslookup program." 441 "Run nslookup program."
442 (interactive) 442 (interactive)
443 (require 'comint)
443 (comint-run nslookup-program) 444 (comint-run nslookup-program)
444 (set-process-filter (get-buffer-process "*nslookup*") 445 (set-process-filter (get-buffer-process "*nslookup*")
445 'net-utils-remove-ctrl-m-filter) 446 'net-utils-remove-ctrl-m-filter)
@@ -459,6 +460,7 @@ If your system's ping continues until interrupted, you can try setting
459(defun ftp (host) 460(defun ftp (host)
460 "Run ftp program." 461 "Run ftp program."
461 (interactive "sFtp to Host: ") 462 (interactive "sFtp to Host: ")
463 (require 'comint)
462 (let ((buf (get-buffer-create (concat "*ftp [" host "]*")))) 464 (let ((buf (get-buffer-create (concat "*ftp [" host "]*"))))
463 (set-buffer buf) 465 (set-buffer buf)
464 (comint-mode) 466 (comint-mode)
@@ -578,23 +580,79 @@ This list in not complete.")
578 user-and-host 580 user-and-host
579 ))) 581 )))
580 582
581(defcustom whois-server-name "whois.internic.net" 583(defcustom whois-server-name "whois.arin.net"
582 "Host name for the whois service." 584 "Default host name for the whois service."
583 :group 'net-utils 585 :group 'net-utils
584 :type 'string 586 :type 'string
585 ) 587 )
586 588
589(defcustom whois-server-list
590 '(("whois.arin.net") ; Networks, ASN's, and related POC's (numbers)
591 ("rs.internic.net") ; domain related info
592 ("whois.abuse.net")
593 ("whois.apnic.net")
594 ("nic.ddn.mil")
595 ("whois.nic.mil")
596 ("whois.nic.gov")
597 ("whois.ripe.net"))
598 "A list of whois servers that can be queried."
599 :group 'net-utils
600 :type '(repeat (list)))
601
602(defcustom whois-server-tld
603 '(("rs.internic.net" . "com")
604 ("rs.internic.net" . "org")
605 ("whois.ripe.net" . "be")
606 ("whois.ripe.net" . "de")
607 ("whois.ripe.net" . "dk")
608 ("whois.ripe.net" . "it")
609 ("whois.ripe.net" . "fi")
610 ("whois.ripe.net" . "fr")
611 ("whois.ripe.net" . "uk")
612 ("whois.apnic.net" . "au")
613 ("whois.apnic.net" . "ch")
614 ("whois.apnic.net" . "hk")
615 ("whois.apnic.net" . "jp")
616 ("whois.nic.gov" . "gov")
617 ("whois.nic.mil" . "mil"))
618 "Alist to map top level domains to whois servers."
619 :group 'net-utils
620 :type '(repeat (cons string string)))
621
622(defcustom whois-guess-server t
623 "If non-nil then whois will try to deduce the appropriate whois
624server from the query. If the query doesn't look like a domain or hostname
625then the server named by whois-server-name is used."
626 :group 'net-utils
627 :type 'boolean)
628
629
630(defun whois-get-tld (host)
631 (do ((i (1- (length host)) (1- i))
632 (max-len (- (length host) 4)))
633 ((or (= i max-len) (char-equal (aref host i) ?.))
634 (if (= i max-len) nil
635 (substring host (1+ i))))))
636
587;; Whois protocol 637;; Whois protocol
588;;;###autoload 638;;;###autoload
589(defun whois (arg search-string) 639(defun whois (arg search-string)
590 "Send SEARCH-STRING to server defined by the `whois-server-name' variable. 640 "Send SEARCH-STRING to server defined by the `whois-server-name' variable.
591With argument, prompt for whois server." 641If `whois-guess-server' is non-nil, then try to deduce the correct server
642from SEARCH-STRING. With argument, prompt for whois server."
592 (interactive "P\nsWhois: ") 643 (interactive "P\nsWhois: ")
593 (let ((host 644 (let* ((whois-apropos-host (if whois-guess-server
594 (if arg 645 (rassoc (whois-get-tld search-string)
595 (read-from-minibuffer "Whois server name: ") 646 whois-server-tld)
596 whois-server-name)) 647 nil))
597 ) 648 (server-name (if whois-apropos-host
649 (car whois-apropos-host)
650 whois-server-name))
651 (host
652 (if arg
653 (completing-read "Whois server name: "
654 whois-server-list nil nil "whois.")
655 server-name)))
598 (run-network-program 656 (run-network-program
599 "Whois" 657 "Whois"
600 host 658 host
@@ -643,6 +701,7 @@ With argument, prompt for whois server."
643 701
644(defun network-service-connection (host service) 702(defun network-service-connection (host service)
645 "Open a network connection to SERVICE on HOST." 703 "Open a network connection to SERVICE on HOST."
704 (require 'comint)
646 (let ( 705 (let (
647 (process-name (concat "Network Connection [" host " " service "]")) 706 (process-name (concat "Network Connection [" host " " service "]"))
648 (portnum (string-to-number service)) 707 (portnum (string-to-number service))