[cl-cookbook-contrib] getenv
Brought to you by:
jthing
|
From: Heow Eide-G. <li...@al...> - 2004-10-11 01:54:41
|
Guys,
I noticed that the CLOCC ports collection also has a getenv defined as
is also in the cl-cookbook.
in CLOCC Ports or cl-ports of Debian, sys.lisp:
(defun getenv (var)
"Return the value of the environment variable."
#+allegro (sys::getenv (string var))
#+clisp (sys::getenv (string var))
#+cmu (cdr (assoc (string var) ext:*environment-list* :test #'equalp
:key #'string))
#+gcl (si:getenv (string var))
#+lispworks (lw:environment-variable (string var))
#+lucid (lcl:environment-variable (string var))
#+mcl (ccl::getenv var)
#+sbcl (sb-ext:posix-getenv var)
#-(or allegro clisp cmu gcl lispworks lucid mcl sbcl)
(error 'not-implemented :proc (list 'getenv var)))
in the cl-cookbook:
(defun my-getenv (name &optional default)
#+CMU
(let ((x (assoc name ext:*environment-list*
:test #'string=)))
(if x (cdr x) default))
#-CMU
(or
#+Allegro (sys:getenv name)
#+CLISP (ext:getenv name)
#+ECL (si:getenv name)
#+SBCL (sb-unix::posix-getenv name)
#+LISPWORKS (lispworks:environment-variable name)
default))
- Heow
|