]> git.eshelyaron.com Git - emacs.git/commitdiff
(whois-get-tld): Rewrite not to use `do'.
authorRichard M. Stallman <rms@gnu.org>
Wed, 21 Oct 1998 18:09:39 +0000 (18:09 +0000)
committerRichard M. Stallman <rms@gnu.org>
Wed, 21 Oct 1998 18:09:39 +0000 (18:09 +0000)
lisp/net-utils.el

index 111d20f0239349c0d8385a5fc9ed943d5f10a36c..48698db99bf159ed97eb3c1a01a2c41c145e964e 100644 (file)
@@ -626,13 +626,15 @@ then the server named by whois-server-name is used."
   :group 'net-utils
   :type 'boolean)
 
-
 (defun whois-get-tld (host)
-  (do ((i (1- (length host)) (1- i))
-       (max-len (- (length host) 4)))
-      ((or (= i max-len) (char-equal (aref host i) ?.))
-       (if (= i max-len) nil
-        (substring host (1+ i))))))
+  "Return the top level domain of `host', or nil if it isn't a domain name."
+  (let ((i (1- (length host)))
+       (max-len (- (length host) 5)))
+    (while (not (or (= i max-len) (char-equal (aref host i) ?.)))
+      (setq i (1- i)))
+    (if (= i max-len)
+       nil
+      (substring host (1+ i)))))
 
 ;; Whois protocol
 ;;;###autoload