Mercurial > emacs
comparison lisp/net-utils.el @ 23529:ccedc9675dab
(whois-get-tld): Rewrite not to use `do'.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 21 Oct 1998 18:09:39 +0000 |
parents | 8256c4d22113 |
children | 1d78cd7c460d |
comparison
equal
deleted
inserted
replaced
23528:3bb7a66a51a8 | 23529:ccedc9675dab |
---|---|
624 server from the query. If the query doesn't look like a domain or hostname | 624 server from the query. If the query doesn't look like a domain or hostname |
625 then the server named by whois-server-name is used." | 625 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 |
639 (defun whois (arg search-string) | 641 (defun whois (arg search-string) |
640 "Send SEARCH-STRING to server defined by the `whois-server-name' variable. | 642 "Send SEARCH-STRING to server defined by the `whois-server-name' variable. |