From 0b8c33af3f9e8ea787f21ca7e9600ba564f67e8b Mon Sep 17 00:00:00 2001 From: mainzelm Date: Mon, 10 Feb 2003 13:13:26 +0000 Subject: [PATCH] Removed fqdn? and unqualified-hostname --- scheme/lib/dns.scm | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/scheme/lib/dns.scm b/scheme/lib/dns.scm index 9225b71..b8695ea 100644 --- a/scheme/lib/dns.scm +++ b/scheme/lib/dns.scm @@ -1424,8 +1424,12 @@ (socket-address->internet-address addr) (apply dns-lookup-ip ip32 args))) -(define (fqdn? name) - (regexp-search? (rx #\.) name)) +;; Some code to test the components of domain names +;;(define label-regexp +;; (rx (: alpha (? (* (| alphanumeric "-")) alphanumeric)))) +;;(define (unqualified-hostname name) +;; (regexp-search? (rx (: ,label-regexp)) name)) + (define (maybe-dns-lookup-name name . args) (call-with-current-continuation @@ -1435,7 +1439,7 @@ (k #f) (more))) (lambda () - (dns-lookup-name name args)))))) + (apply dns-lookup-name name args)))))) (define (maybe-dns-lookup-ip ip-addr . args) (call-with-current-continuation @@ -1460,16 +1464,18 @@ (if (socket-address? name-or-socket-address) (apply socket-address->fqdn name-or-socket-address args) (let ((name name-or-socket-address)) - (if (fqdn? name) - name - (let lp ((domains (domains-for-search))) - (if (null? domains) - #f - (cond ((apply maybe-dns-lookup-name - (string-append name "." (car domains)) args) - => (lambda (ip) - (apply dns-lookup-ip ip args))) - (else (lp (cdr domains)))))))))) + (cond ((apply maybe-dns-lookup-name name args) + => (lambda (ip) + (apply dns-lookup-ip ip args))) + (else + (let lp ((domains (domains-for-search))) + (if (null? domains) + #f + (cond ((apply maybe-dns-lookup-name + (string-append name "." (car domains)) args) + => (lambda (ip) + (apply dns-lookup-ip ip args))) + (else (lp (cdr domains))))))))))) (define (system-fqdn . args) (apply host-fqdn (system-name) args))