Next Previous Up Top Contents Index

12 The LISPWORKS Package

environment-variable

Function

Summary

Reads the value of an environment variable from the environment table of the calling process.
Package

lispworks

Signature

environment-variable name => result

Arguments

name

A string.

Values

result

A string ornil.

Description

The functionenvironment-variable reads the environment variable specified by name and returns its value, ornil if the variable could not be found.
Asetf method is also defined, allowing you to set the value of an environment variable:
(setf (environment-variable name) value)

If value is a string, then name is set to be value. If value isnil then name is removed from the environment table.
Example

In this first example the value of the environment variablePATH is returned:
(environment-variable "PATH")

The result is a string of all the defined paths:
 "c:\\hqbin\\nt\\x86;c:\\hqbin\\nt\\x86\\perl;c:\\hqbin\\win32;c:\\usr\\local\\bin;C:\\WINNT35\\system32;C:\\WINNT35;;C:\\MSTOOLS\\bin;C:\\TGS3D\\PROGRAM;c:\\program files\\devstudio\\sharedide\\bin\\ide;c:\\program files\\devstudio\\sharedide\\bin;c:\\program files\\devstudio\\vc\\bin;c:\\msdev\\bin;C:\\WINDOWS;C:\\WINDOWS\\COMMAND;C:\\WIN95\\COMMAND;C:\\MSINPUT\\MOUSE"

In the second example, the variableMYTZONE is found not to be in the environment table:
(environment-variable "MYTZONE")

NIL

It is set to beGMT using thesetf method:
(setf (environment-variable "MYTZONE") "GMT")


LispWorks Reference Manual - 15 Oct 1998

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker