Re: getenv

Nick Levine <[email protected]> Mon, 11 Oct 2004 17:53:33 +0100 (BST)
Newsgroups gmane.lisp.cookbook
Message-ID <[email protected]>
   > 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))

   Yes, but I think the cookbook version does its job. 

But the cookbook verson is wrong. It doesn't distinguish between
implementation-not-found and env-var-not-found.

- nick


-------------------------------------------------------
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