$Revision: 5.0.2.4 $
Package: SYSTEM
Arguments: (string)
This function returns the value (a string) of an environment variable (such as TERM, SHELL, and DISPLAY). If the environment variable is not defined, nil is returned. This function may be used with setf to set an environment variable. For example:
;; The current values of the environment variable on your system may,
;; of course, be different from what appears in this example.
user(2): (sys:getenv "SHELL")
"/bin/csh"
user(3): (setf (sys:getenv "SHELL") "/bin/sh")
"/bin/sh"
user(4): (sys:getenv "SHELL")
"/bin/sh"
Warning: When you use setf with sys:getenv to set an environment variable, the string specifying the new value is stored in malloc'ed space and that space cannot be freed (in any practical way). This creates a small memory leak in the system, but it should only be significant if you set many, many environment variables.
Note that there is no pre-defined, programmatic way to unset an environment variable from within Lisp. It is an error to setf sys:getenv to anything other than a string and the effect of doing so is undefined (an error is typically not signaled but the behavior is likely not what is intended). Specifically.
(setf (sys:getenv "VAR") nil)
does not unset VAR in the environment.
See os_interface.htm.
The general documentation description is in introduction.htm. The index is in index.htm.
Copyright (C) 1998-1999, Franz Inc., Berkeley, CA. All Rights Reserved.