Subject: Re: Hypercube in lisp (newbie)
From: rpw3@rpw3.org (Rob Warnock)
Date: Thu, 25 Aug 2005 03:12:55 -0500
Newsgroups: comp.lang.lisp
Message-ID: <Ud6dnVDoSY4a4JDeRVn-rg@speakeasy.net>
Pascal Bourguignon  <spam@mouse-potato.com> wrote:
+---------------
| (defun get-environment-variable (string)
|   #-clisp (cdr (assoc string ext:*environment-list* :test #'string=))
|   #+clisp (ext:getenv string))
+---------------

I tend to use this one, which covers a few more cases:  ;-}

    ;;; GETENV -- Mostly-portable code for accessing Unix
    ;;; (or Windows?) environment variables. Morphed very slightly
    ;;; from <URL:http://cl-cookbook.sourceforge.net/os.html>
    ;;; Copyright (c) 2002 The Common Lisp Cookbook Project 
    ;;; See: <URL:http://cl-cookbook.sourceforge.net/license.html>
    (defun getenv (name &optional default)
      (or
       #+CMU (cdr (assoc name ext:*environment-list* :test #'string=))
       #+Allegro (sys:getenv name)
       #+CLISP (ext:getenv name)
       #+ECL (si:getenv name)
       #+SBCL (sb-unix::posix-getenv name)
       #+LISPWORKS (lispworks:environment-variable name)
       default))


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607