diff options
author | Saúl Ibarra Corretgé <s@saghul.net> | 2019-08-01 09:48:38 +0200 |
---|---|---|
committer | Saúl Ibarra Corretgé <s@saghul.net> | 2019-08-03 08:33:42 +0200 |
commit | 2480b6158a3a21da564bdb565c4db827df176a4e (patch) | |
tree | 94300fac1a9db79e190a68539fb692fe22c3e963 /docs/src | |
parent | ef218cede9cf9463dc55b9f807e0fad0114f789e (diff) | |
download | libuv-2480b6158a3a21da564bdb565c4db827df176a4e.tar.gz libuv-2480b6158a3a21da564bdb565c4db827df176a4e.zip |
unix,win: add ability to retrieve all env variables
Fixes: https://github.com/libuv/libuv/issues/2400
PR-URL: https://github.com/libuv/libuv/pull/2404
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Diffstat (limited to 'docs/src')
-rw-r--r-- | docs/src/misc.rst | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/docs/src/misc.rst b/docs/src/misc.rst index ef70e14b..3ecfce48 100644 --- a/docs/src/misc.rst +++ b/docs/src/misc.rst @@ -180,6 +180,17 @@ Data types char machine[256]; } uv_utsname_t; +.. c:type:: uv_env_item_t + + Data type for environment variable storage. + + :: + + typedef struct uv_env_item_s { + char* name; + char* value; + } uv_env_item_t; + API --- @@ -523,6 +534,23 @@ API .. versionadded:: 1.8.0 +.. c:function:: int uv_os_environ(uv_env_item_t** envitems, int* count) + + Retrieves all environment variables. This function will allocate memory + which must be freed by calling :c:func:`uv_os_free_environ`. + + .. warning:: + This function is not thread safe. + + .. versionadded:: 1.31.0 + +.. c:function:: void uv_os_free_environ(uv_env_item_t* envitems, int count); + + Frees the memory allocated for the environment variables by + :c:func:`uv_os_environ`. + + .. versionadded:: 1.31.0 + .. c:function:: int uv_os_getenv(const char* name, char* buffer, size_t* size) Retrieves the environment variable specified by `name`, copies its value |