Hostname: Difference between revisions
Content added Content deleted
Line 98: | Line 98: | ||
Another operating system feature that is implemented differently across lisp implementations. Here we show how to create a function that obtains the required result portably by working differently for each supported implementation. This technique is heavily used to make portable lisp libraries. |
Another operating system feature that is implemented differently across lisp implementations. Here we show how to create a function that obtains the required result portably by working differently for each supported implementation. This technique is heavily used to make portable lisp libraries. |
||
<lang lisp>(defun get-host-name () |
<lang lisp>(defun get-host-name () |
||
#+sbcl (machine-instance) |
#+(or sbcl ccl) (machine-instance) |
||
#+clisp (let ((s (machine-instance))) (subseq s 0 (position #\Space s))) |
#+clisp (let ((s (machine-instance))) (subseq s 0 (position #\Space s))) |
||
#-(or sbcl clisp) (error "get-host-name not implemented"))</lang> |
#-(or sbcl ccl clisp) (error "get-host-name not implemented"))</lang> |
||
{{libheader|CFFI}} |
{{libheader|CFFI}} |