c/program/getenv

@1@ Searches for an environmental variable with name in the host-specified environment list and returns a pointer to the string that is associated with the matched environment variable. The set of environmental variables and methods of altering it are implementation-defined. @@ This function is not required to be thread-safe. Another call to getenv, as well as a call to the POSIX functions, , and may invalidate the pointer returned by a previous call or modify the string obtained from a previous call. @@ Modifying the string returned by invokes undefined behavior. @2@ Same as, except that the values of the environment variable is written to the user-provided buffer (unless null) and the number of bytes written is stored in the user-provided location  (unless null). If the environment variable is not set in the environment, zero is written to (unless null) and  is written to  (unless null). In addition, the following errors are detected at runtime and call the currently installed constraint handler function:
 * is a null pointer
 * is greater than rsize_max
 * is a null pointer and is not zero

Return value
@1@ character string identifying the value of the environmental variable or null pointer if such variable is not found. @2@ zero if the environment variable was found, non-zero if it was not found or if a runtime constraint violation occurred. On any error, writes zero to (unless  is a null pointer).