Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!gatech!swrinde!pipex!dircon!rheged!simon
From: simon@rheged.dircon.co.uk (Simon Brooke)
Subject: Re: Environment variables? (Unix)
Message-ID: <D7u73A.7qp@rheged.dircon.co.uk>
Organization: none. Disorganization: total.
References: <3nphgo$ha8@kadath.zeitgeist.net> <19950428T113646Z.enag@naggum.no>
Date: Sun, 30 Apr 1995 07:21:08 GMT
Lines: 41

In article <19950428T113646Z.enag@naggum.no>,
Erik Naggum  <erik@naggum.no> wrote:
>Peter Seibel
>
>|   Is it possible to access Unix environment variables in Common Lisp.
>
>only on Unix implementations.

(...)

>unfortunately, the three Lisps that I just tested on have not agreed on how
>to do it.  here's a unified version
>
>(defun get-environment-variable (var)
>  "Return the value of environment variable VAR, or NIL if none."
>  (declare (string var))
>  (prog1
>    #+(and :unix :cmu17) (cdr (assoc (intern var :keyword) *environment-list*))
>    #+(and :unix :kcl)   (system:getenv var)	;also AKCL, GCL
>    #+(and :unix :clisp) (system::getenv var)
>    nil))
>

Wouldn't it be nicer simply to write a function or macro 'getenv' (one
arg, a symbol, returns a string) for each CL implementation, and
politely suggest to each CL vendor that they adopt this format? After
all, the number of us who are still running LisP down to the hardware
is reducing :-< and most operating systems in current use (not just
UN*X) have a concept of 'environment variables'.

After all, as Erik says,

>it would be nice to have
>a fully portable function among Unix systems.



-- 
------- simon@rheged.dircon.co.uk (Simon Brooke)

	;; When your hammer is C++, everything begins to look like a thumb.
