The %getenv() function searches the environment for a string of the form name=value and returns a pointer to value in the current environment if such a string is present, otherwise, a null is returned.
pointer = (char*)%getenv(name)
* Gets and displays the PATH environment variable
cfunction unix.builtin
pointer=(char*)%getenv('PATH')
if pointer = 0 then
print "PATH is not defined"
end else
* We got a C pointer the path variable. Copy it
* into pick variable
char path[1024]
%strcpy(path, (char*)pointer)
path = field(path,char(0),1)
print path
end