Hostname: Difference between revisions

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.
<lang lisp>(defun get-host-name ()
#+(or sbcl ccl) (machine-instance)
#+clisp (let ((s (machine-instance))) (subseq s 0 (position #\Space s)))
#-(or sbcl ccl clisp) (error "get-host-name not implemented"))</lang>
 
{{libheader|CFFI}}
Anonymous user