X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/zone/blobdiff_plain/7d593efdac74772541cd65e959a890a70ffd8e97..51a6847e534bc908f97f068c5ed82ed11c85ce15:/zone.lisp diff --git a/zone.lisp b/zone.lisp index 64488c2..37e7499 100644 --- a/zone.lisp +++ b/zone.lisp @@ -144,9 +144,18 @@ (defstruct (zone (:predicate zonep)) ;;;-------------------------------------------------------------------------- ;;; Zone defaults. It is intended that scripts override these. +#+ecl +(cffi:defcfun gethostname :int + (name :pointer) + (len :uint)) + (defvar *default-zone-source* (let ((hn #+cmu (unix:unix-gethostname) - #+clisp (unix:get-host-name))) + #+clisp (unix:get-host-name) + #+ecl (cffi:with-foreign-pointer-as-string (buffer 256 len) + (let ((rc (gethostname buffer len))) + (unless (zerop rc) + (error "gethostname(2) failed (rc = ~A)." rc)))))) (and hn (concatenate 'string (canonify-hostname hn) "."))) "The default zone source: the current host's name.")