aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-10-21 18:09:39 +0000
committerRichard M. Stallman1998-10-21 18:09:39 +0000
commit3d0ee5e6c9ad3bddea0a5baa1679868ea0f7bf62 (patch)
treef74e401439a00a446d4267f8672e028022edea4c
parentb054090e748f2d1d04d6769285dafa7b46abd375 (diff)
downloademacs-3d0ee5e6c9ad3bddea0a5baa1679868ea0f7bf62.tar.gz
emacs-3d0ee5e6c9ad3bddea0a5baa1679868ea0f7bf62.zip
(whois-get-tld): Rewrite not to use `do'.
-rw-r--r--lisp/net-utils.el14
1 files changed, 8 insertions, 6 deletions
diff --git a/lisp/net-utils.el b/lisp/net-utils.el
index 111d20f0239..48698db99bf 100644
--- a/lisp/net-utils.el
+++ b/lisp/net-utils.el
@@ -626,13 +626,15 @@ then the server named by whois-server-name is used."
626 :group 'net-utils 626 :group 'net-utils
627 :type 'boolean) 627 :type 'boolean)
628 628
629
630(defun whois-get-tld (host) 629(defun whois-get-tld (host)
631 (do ((i (1- (length host)) (1- i)) 630 "Return the top level domain of `host', or nil if it isn't a domain name."
632 (max-len (- (length host) 4))) 631 (let ((i (1- (length host)))
633 ((or (= i max-len) (char-equal (aref host i) ?.)) 632 (max-len (- (length host) 5)))
634 (if (= i max-len) nil 633 (while (not (or (= i max-len) (char-equal (aref host i) ?.)))
635 (substring host (1+ i)))))) 634 (setq i (1- i)))
635 (if (= i max-len)
636 nil
637 (substring host (1+ i)))))
636 638
637;; Whois protocol 639;; Whois protocol
638;;;###autoload 640;;;###autoload