Commit 1595b6fd authored by Robert P. Goldman's avatar Robert P. Goldman

DEFSETF GETENV added.

Needed for some testing.
parent 8270978f
......@@ -76,7 +76,6 @@ that is neither Unix, nor Windows, nor Genera, nor even old MacOS.~%Now you port
(detect-os))
;;;; Environment variables: getting them, and parsing them.
(with-upgradability ()
(defun getenv (x)
"Query the environment, as in C getenv.
......@@ -109,6 +108,21 @@ use getenvp to return NIL in such a case."
#-(or abcl allegro clisp clozure cmu cormanlisp ecl gcl genera lispworks mcl mkcl sbcl scl xcl)
(error "~S is not supported on your implementation" 'getenv))
(defsetf getenv (x) (val)
"Set an environment variable."
(declare (ignorable x val))
#+clisp `(system::setenv ,x ,val)
#+ecl `(ext:setenv ,x ,val)
#+allegro `(setf (sys:getenv ,x) ,val)
#+clozure `(ccl:setenv ,x ,val)
#+cmu `(unix:unix-setenv ,x ,val 1)
#+lispworks `(hcl:setenv ,x ,val)
#+mkcl `(mkcl:setenv ,x ,val)
#+sbcl `(progn (require :sb-posix) (symbol-call :sb-posix :setenv ,x ,val 1))
#-(or allegro clisp clozure ecl lispworks mkcl sbcl cmu)
'(error "SETF ~S is not supported on your implementation" 'getenv))
(defun getenvp (x)
"Predicate that is true if the named variable is present in the libc environment,
then returning the non-empty string value of the variable"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment