fixing system-fqdn
This commit is contained in:
		
							parent
							
								
									52036a75ad
								
							
						
					
					
						commit
						d8c1e7f0ad
					
				|  | @ -33,24 +33,11 @@ | |||
|            (write-char c) | ||||
|            (loop (read-char fd)))))) | ||||
| 
 | ||||
| ;; out from ecm-utilities.scm | ||||
| ;; please tell me if this doesn't work on your system. | ||||
| 
 | ||||
| (define (system-fqdn) | ||||
|   (let ((sysname (system-name))) | ||||
|     (if (string-index sysname #\.) | ||||
|         sysname | ||||
|         (nslookup-fqdn)))) | ||||
| 
 | ||||
| ;; This doesn't work on my system. Probably it is not configured well. | ||||
| ;; 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")))) | ||||
|   (let ((host (host-info (system-name)))) | ||||
|     (let loop ((addresses (host-info:addresses host))) | ||||
|       (if (null? addresses) | ||||
| 	  #f | ||||
| 	  (or (dns-lookup-ip (car addresses)) | ||||
| 	      (loop (cdr addresses))))))) | ||||
|  |  | |||
|  | @ -637,6 +637,7 @@ | |||
| 	sigevents | ||||
| 	let-opt | ||||
| 	srfi-13 | ||||
| 	dns | ||||
| 	handle-fatal-error) | ||||
|   (files (lib sunet-utilities))) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 interp
						interp