Miscellaneous categories
Platform
Environment variables
Process handling

Environment variables [XL]

Additionally to the CLAIRE getenv method, XL CLAIRE provides some tools that make possible to change an environment variable (setenv) or iterate over the whole environment of the process (environ/maxenv) as in :
 (for i in (1 .. maxenv())
     let (vval:= explode_wildcard(environ(i), "*=*")
     in (assert(getenv(v= val),
         printf("~A = ~S\n"vval)))
Note that setenv and


categories Environment variablesnormal dispatch [XL] Kernel method

environ(i:integer) -> string

environ(i) returns the ithenvironment variable (1 based index) in the form "var=value".


categories Environment variablesnormal dispatch Core method

getenv(self:string) -> string

getenv(s) returns the value of the environment variable s if it exists and an empty string otherwise.


categories Environment variablesnormal dispatch [XL] Kernel method

isenv?(v:string) -> boolean

isenv?(v) tests the existence of the environment variable v.


categories Environment variablesnormal dispatch [XL] Kernel method

maxenv() -> integer

maxenv() returns the index of the last environment variable. For instance :
 for i in (1 .. maxenv()) printf("~A\n"environ(i))
printf the process environment in the same way as the env shell command.


categories Environment variablesnormal dispatch [XL] Kernel method

setenv(s:string) -> void

setenv(s) adds or updates an environment variable defined by s = "var=value".