fixing system-fqdn
This commit is contained in:
parent
52036a75ad
commit
d8c1e7f0ad
|
@ -33,24 +33,11 @@
|
||||||
(write-char c)
|
(write-char c)
|
||||||
(loop (read-char fd))))))
|
(loop (read-char fd))))))
|
||||||
|
|
||||||
;; out from ecm-utilities.scm
|
|
||||||
;; please tell me if this doesn't work on your system.
|
|
||||||
(define (system-fqdn)
|
(define (system-fqdn)
|
||||||
(let ((sysname (system-name)))
|
(let ((host (host-info (system-name))))
|
||||||
(if (string-index sysname #\.)
|
(let loop ((addresses (host-info:addresses host)))
|
||||||
sysname
|
(if (null? addresses)
|
||||||
(nslookup-fqdn))))
|
#f
|
||||||
|
(or (dns-lookup-ip (car addresses))
|
||||||
;; This doesn't work on my system. Probably it is not configured well.
|
(loop (cdr addresses)))))))
|
||||||
;; Nevertheless, the alternative seems better to me
|
|
||||||
;(define (nslookup-fqdn)
|
|
||||||
; (let* ((cmd (format #f "nslookup ~a" (system-name)))
|
|
||||||
; (raw (string-join (run/strings (nslookup ,(system-name)))))
|
|
||||||
; (match (string-match "Name: +([-a-zA-Z0-9.]+)" raw)))
|
|
||||||
; (display raw)
|
|
||||||
; (match:substring match 1)))
|
|
||||||
|
|
||||||
(define (nslookup-fqdn)
|
|
||||||
(host-info:name (host-info (system-name))))
|
|
||||||
; another easy alternative:
|
|
||||||
; (car (run/strings (hostname "--long"))))
|
|
||||||
|
|
|
@ -637,6 +637,7 @@
|
||||||
sigevents
|
sigevents
|
||||||
let-opt
|
let-opt
|
||||||
srfi-13
|
srfi-13
|
||||||
|
dns
|
||||||
handle-fatal-error)
|
handle-fatal-error)
|
||||||
(files (lib sunet-utilities)))
|
(files (lib sunet-utilities)))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue