Function

GLibenviron_getenv

Declaration

const gchar*
g_environ_getenv (
  gchar** envp,
  const gchar* variable
)

Description

Returns the value of the environment variable variable in the provided list envp.

Available since:2.32

Parameters

envp

Type: An array of filename

an environment list (eg, as returned from g_get_environ()), or `NULL`
for an empty environment list.

The argument can be NULL.
The array must be NULL-terminated.
The data is owned by the caller of the function.
Each element is a file system path, using the OS encoding.
variable

Type: const gchar*

The environment variable to get.

The data is owned by the caller of the function.
The value is a file system path, using the OS encoding.

Return value

Type: const gchar*

The value of the environment variable, or NULL if the environment variable is not set in envp. The returned string is owned by envp, and will be freed if variable is set or unset again.

The data is owned by the called function.
The return value can be NULL.
The value is a file system path, using the OS encoding.