From: Richard M. Stallman Date: Wed, 21 Oct 1998 18:09:39 +0000 (+0000) Subject: (whois-get-tld): Rewrite not to use `do'. X-Git-Tag: emacs-20.4~1420 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3d0ee5e6c9ad3bddea0a5baa1679868ea0f7bf62;p=emacs.git (whois-get-tld): Rewrite not to use `do'. --- 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." :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