rlib
Convenience library for useful things
Loading...
Searching...
No Matches
Environment variables

Cross-platform wrappers around the C library's environment accessors. Lookup, set (optionally overwriting) and unset. More...

Functions

const rchar * r_getenv (const rchar *key)
 Look up key in the process environment.
 
rboolean r_setenv (const rchar *key, const rchar *val, rboolean always)
 Set key to val in the process environment.
 
rboolean r_unsetenv (const rchar *key)
 Remove key from the process environment.
 

Detailed Description

Cross-platform wrappers around the C library's environment accessors. Lookup, set (optionally overwriting) and unset.

Function Documentation

◆ r_getenv()

const rchar * r_getenv ( const rchar *  key)

Look up key in the process environment.

Returns
Pointer to the value (owned by the environment, not the caller), or NULL if key is unset or key is NULL. Treat the result as valid only until the next call to any of these accessors (on win32 it is a per-thread UTF-8 conversion of the environment, reused on the next lookup).

◆ r_setenv()

rboolean r_setenv ( const rchar *  key,
const rchar *  val,
rboolean  always 
)

Set key to val in the process environment.

Parameters
keyVariable name.
valNew value.
alwaysTRUE to overwrite an existing value, FALSE to keep an already-set value unchanged.
Returns
TRUE on success.