Re: [cl-cookbook-contrib] getenv
Brought to you by:
jthing
From: Edi W. <ed...@ag...> - 2004-10-11 15:14:59
|
On 10 Oct 2004 21:49:46 -0400, Heow Eide-Goodman <li...@al...> wrote: > 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)) Yes, but I think the cookbook version does its job. Its main job, IMHO, is to give "newbies" an idea about where to look for similar stuff. IIRC CLOCC is GPL so I'm not even sure if we're allowed to integrate CLOCC code into the cookbook without changing our license. IANAL. Cheers, Edo. |