getenv
Heow Eide-Goodman <[email protected]> 10 Oct 2004 21:49:46 -0400
| Newsgroups | gmane.lisp.cookbook |
|---|---|
| Message-ID | <1097459387.1119.114.camel@sushi> |
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
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl