From: Mark Wooding Date: Wed, 24 May 2006 08:20:50 +0000 (+0100) Subject: Attempt to port the lot to CLisp. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/zone/commitdiff_plain/7d593efdac74772541cd65e959a890a70ffd8e97 Attempt to port the lot to CLisp. This is going to need more work, because CLisp is lacking an interface to gethostbyname. We may grow a dependency on CFFI. --- diff --git a/.gitignore b/.gitignore index c02f71b..b94a63c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ *.x86f +*.fas +*.lib diff --git a/net.lisp b/net.lisp index 35e4340..d957f53 100644 --- a/net.lisp +++ b/net.lisp @@ -256,19 +256,20 @@ (defun ipnet-changeable-bytes (mask) ;;;-------------------------------------------------------------------------- ;;; Name resolution. -#+cmu (defun resolve-hostname (name) "Resolve a hostname to an IP address using the DNS, or return nil." - (let ((he (ext:lookup-host-entry name))) - (and he - (ext:host-entry-addr he)))) + #+cmu (let ((he (ext:lookup-host-entry name))) + (and he + (ext:host-entry-addr he))) + #-cmu nil +) -#+cmu (defun canonify-hostname (name) "Resolve a hostname to canonical form using the DNS, or return nil." - (let ((he (ext:lookup-host-entry name))) - (and he - (ext:host-entry-name he)))) + #+cmu (let ((he (ext:lookup-host-entry name))) + (and he + (ext:host-entry-name he))) + #-cmu nil) ;;;-------------------------------------------------------------------------- ;;; Host names and specifiers. diff --git a/zone.lisp b/zone.lisp index 35e6f80..64488c2 100644 --- a/zone.lisp +++ b/zone.lisp @@ -145,7 +145,8 @@ (defstruct (zone (:predicate zonep)) ;;; Zone defaults. It is intended that scripts override these. (defvar *default-zone-source* - (let ((hn (unix:unix-gethostname))) + (let ((hn #+cmu (unix:unix-gethostname) + #+clisp (unix:get-host-name))) (and hn (concatenate 'string (canonify-hostname hn) "."))) "The default zone source: the current host's name.") @@ -754,8 +755,8 @@ (defun zone-write (zone &optional (stream *standard-output*)) ;;; Zone file `~(~A~)' ;;; (generated ~A) -$ORIGIN ~@0*~(~A.~) -$TTL ~@2*~D~2%" +$ORIGIN ~0@*~(~A.~) +$TTL ~2@*~D~2%" (zone-name zone) (iso-date :now :datep t :timep t) (zone-default-ttl zone))