How to determine the operating system and hostname using generic lisp?

To get my .sbclrc file running on the two computers that I use, I would like to get a way to get the hostname and / or operating system from sbcl. I know that I can set and then look for an environment variable, but is there a more direct approach?

Update

I changed the question to address general lisp, as the answer from Ken is not specific to sbcl.

+7
common-lisp sbcl
source share
2 answers

I would use the functions:

* (machine-instance) "myhostname" * (machine-type) "X86-64" * (machine-version) "Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz" * (software-type) "Linux" * (software-version) "2.6.32-3-amd64" 
+17
source share
 * (require :sb-bsd-sockets) ("SB-BSD-SOCKETS" "SB-GROVEL" "ASDF") * (use-package :sb-bsd-sockets) T * (host-ent-name (get-host-by-name "localhost")) "myhost.mydomain.ext" * (find :win32 *features*) :WIN32 * (find :linux *features*) NIL 

EDIT: I like @Ken's solution better. +1

+1
source share

All Articles