Skip to content
Snippets Groups Projects
Commit 1595b6fd authored by Robert P. Goldman's avatar Robert P. Goldman
Browse files

DEFSETF GETENV added.

Needed for some testing.
parent 8270978f
No related branches found
No related tags found
No related merge requests found
...@@ -76,7 +76,6 @@ that is neither Unix, nor Windows, nor Genera, nor even old MacOS.~%Now you port ...@@ -76,7 +76,6 @@ that is neither Unix, nor Windows, nor Genera, nor even old MacOS.~%Now you port
(detect-os)) (detect-os))
;;;; Environment variables: getting them, and parsing them. ;;;; Environment variables: getting them, and parsing them.
(with-upgradability () (with-upgradability ()
(defun getenv (x) (defun getenv (x)
"Query the environment, as in C getenv. "Query the environment, as in C getenv.
...@@ -109,6 +108,21 @@ use getenvp to return NIL in such a case." ...@@ -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) #-(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)) (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) (defun getenvp (x)
"Predicate that is true if the named variable is present in the libc environment, "Predicate that is true if the named variable is present in the libc environment,
then returning the non-empty string value of the variable" then returning the non-empty string value of the variable"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment