EnvGet
Description
Read an environment variable. Direct wrapper over the OS-supplied getenv (libc on POSIX, GetEnvironmentVariableA on Windows) so that consumers don’t have to pull <stdlib.h> for the prototype.
Parameters
| Name | Direction | Description |
|---|---|---|
name |
in | NUL-terminated environment variable name. |
Success
Returns a pointer to the value string (process-owned).
Failure
Returns NULL when the variable is not set.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
PdbCache.c:26:
static const char *tmp_dir_path(void) {
#ifdef _WIN32
const char *p = EnvGet("TEMP");
if (p && *p)
return p;- In
PdbCache.c:29:
if (p && *p)
return p;
p = EnvGet("TMP");
if (p && *p)
return p;- In
PdbCache.c:34:
return "C:/Windows/Temp";
#else
const char *p = EnvGet("TMPDIR");
if (p && *p)
return p;- In
Sys.c:342:
#endif
const char *EnvGet(const char *name) {
if (!name) {
return NULL;
Last updated on