| Extracted from Pike v7.8 release 700 at 2013-06-08.

[Top]
MasterObject

# Method MasterObject()->getenv()

Method getenv

  `string getenv(string varname, void|int force_update)`
  `mapping(string:string) getenv(void|int force_update)`

Description

  Queries the environment variables. The first variant returns the value of a specific variable or zero if it doesn't exist in the environment. The second variant returns the whole environment as a mapping. Destructive operations on the mapping will not affect the internal environment representation.

  A cached copy of the real environment is kept to make this function quicker. If the optional flag force_update is nonzero then the real environment is queried and the cache is updated from it. That can be necessary if the environment changes through other means than putenv , typically from a C-level library.

  Variable names and values cannot be wide strings nor contain `'\0'` characters. Variable names also cannot contain `'='` characters.

Note

  On NT the environment variable name is case insensitive.

See also

  putenv()