Attempt to port the lot to CLisp.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 24 May 2006 08:20:50 +0000 (09:20 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Wed, 24 May 2006 08:20:50 +0000 (09:20 +0100)
This is going to need more work, because CLisp is lacking an interface
to gethostbyname.  We may grow a dependency on CFFI.

.gitignore
net.lisp
zone.lisp

index c02f71b..b94a63c 100644 (file)
@@ -1 +1,3 @@
 *.x86f
+*.fas
+*.lib
index 35e4340..d957f53 100644 (file)
--- a/net.lisp
+++ b/net.lisp
 ;;;--------------------------------------------------------------------------
 ;;; 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.
index 35e6f80..64488c2 100644 (file)
--- a/zone.lisp
+++ b/zone.lisp
 ;;; 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.")
 
 ;;; 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))