[previous] [up] [next]     [index]
Next: Runtime Information Up: System Utilities Previous: Operating System Processes

Operating System Environment Variables

(getenv name-string) gets the value of an operating system environment variable. The name-string argument cannot contain a null character; if an environment variable named by name-string exists, its value is returned (as a string); otherwise, #f is returned.

(putenv name-string value-string) sets the value of an operating system environment variable. The name-string and value-string arguments are strings that cannot contain a null character; the environment variable named by name-string is set to value-string. The return value is #t if the assignment succeeds, #f otherwise.

Although MacOS does not have operating system environment variables, getenv returns values installed with putenv (which always succeeds) in the same MzScheme session. When MzScheme is started, an initial environment is read from an Environment file in the current directory if it exists. An Environment file must contain a sequence of two-item lists where the name string is the first item in the list and the value string is the second. For example, an Environment file might contain the following:

 ("PLTCOLLECTS" ";My Disk:Extra Collections:")
 ("USER" "joeuser")



PLT