Minor renamings.

This commit is contained in:
mainzelm 2003-01-16 13:07:14 +00:00
parent f622266015
commit df9cd86232
1 changed files with 21 additions and 8 deletions

View File

@ -1103,15 +1103,18 @@
(define *resolv.conf-cache*) (define *resolv.conf-cache*)
(define *resolv.conf-cache-date* 0) (define *resolv.conf-cache-date* 0)
(define (parse-resolv.conf) (define (resolv.conf)
(let ((actual-m-time (file-info:mtime (file-info "/etc/resolv.conf")))) (let ((actual-m-time (file-info:mtime (file-info "/etc/resolv.conf"))))
(if (> actual-m-time *resolv.conf-cache-date*) (if (> actual-m-time *resolv.conf-cache-date*)
(let ((contents (really-parse-resolv.conf "/etc/resolv.conf"))) (parse-resolv.conf!))
(set! *resolv.conf-cache* contents) *resolv.conf-cache*))
(set! *resolv.conf-cache-date* actual-m-time)
contents)
*resolv.conf-cache*)))
(define (parse-resolv.conf!)
(let ((actual-m-time (file-info:mtime (file-info "/etc/resolv.conf")))
(contents (really-parse-resolv.conf "/etc/resolv.conf")))
(set! *resolv.conf-cache* contents)
(set! *resolv.conf-cache-date* actual-m-time)))
(define (really-parse-resolv.conf file-name) (define (really-parse-resolv.conf file-name)
;; accumulate nameserver entries ;; accumulate nameserver entries
@ -1199,7 +1202,7 @@
;; Figure out the default name servers ;; Figure out the default name servers
(define (dns-find-nameserver-list) (define (dns-find-nameserver-list)
(cond ((assoc 'nameserver (parse-resolv.conf)) (cond ((assoc 'nameserver (resolv.conf))
=> (lambda (nameserver.list) => (lambda (nameserver.list)
(cdr nameserver.list))) (cdr nameserver.list)))
(else '()))) (else '())))
@ -1496,8 +1499,18 @@
(lambda () (lambda ()
(dns-lookup-name name)))))) (dns-lookup-name name))))))
(define (maybe-dns-lookup-ip ip-addr)
(call-with-current-continuation
(lambda (k)
(with-handler (lambda (cond more)
(if (dns-error? cond)
(k #f)
(more)))
(lambda ()
(dns-lookup-ip ip-addr))))))
(define (domains-for-search) (define (domains-for-search)
(let ((resolv.conf (parse-resolv.conf))) (let ((resolv.conf (parse-resolv.conf!)))
(cond ((assoc 'domain resolv.conf) (cond ((assoc 'domain resolv.conf)
=> (lambda (pair) => (lambda (pair)
(list (cdr pair)))) (list (cdr pair))))