PatchworkOS  10941b4
A non-POSIX operating system.
Loading...
Searching...
No Matches
Environment

Environment variables. More...

Collaboration diagram for Environment:

Detailed Description

Environment variables.

Data Structures

struct  env_var_t
 Environment variable structure. More...
 
struct  env_t
 Environment structure. More...
 

Functions

void env_init (env_t *env)
 Initialize the environment.
 
void env_deinit (env_t *env)
 Deinitialize the environment.
 
uint64_t env_copy (env_t *dest, env_t *src)
 Copy environment variables from one environment to another.
 
const charenv_get (env_t *env, const char *key)
 Get the value of an environment variable.
 
uint64_t env_set (env_t *env, const char *key, const char *value)
 Set the value of an environment variable.
 
uint64_t env_unset (env_t *env, const char *key)
 Unset an environment variable.
 

Function Documentation

◆ env_init()

void env_init ( env_t env)

Initialize the environment.

Parameters
envThe environment to initialize.

Definition at line 8 of file env.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ env_deinit()

void env_deinit ( env_t env)

Deinitialize the environment.

Parameters
envThe environment to deinitialize.

Definition at line 15 of file env.c.

Here is the call graph for this function:

◆ env_copy()

uint64_t env_copy ( env_t dest,
env_t src 
)

Copy environment variables from one environment to another.

Parameters
destThe destination environment.
srcThe source environment.
Returns
On success, 0. On failure, returns ERR and errno is set.

Definition at line 26 of file env.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ env_get()

const char * env_get ( env_t env,
const char key 
)

Get the value of an environment variable.

Parameters
envThe environment to search in.
keyThe name of the environment variable.
Returns
A pointer to the value of the environment variable or NULL if it does not exist.

Definition at line 47 of file env.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ env_set()

uint64_t env_set ( env_t env,
const char key,
const char value 
)

Set the value of an environment variable.

If the variable already exists, its value will be updated.

Parameters
envThe environment to modify.
keyThe name of the environment variable.
valueThe value to set the environment variable to.
Returns
On success, 0. On failure, returns ERR and errno is set.

Definition at line 67 of file env.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ env_unset()

uint64_t env_unset ( env_t env,
const char key 
)

Unset an environment variable.

If the variable does not exist, this function does nothing.

Parameters
envThe environment to modify.
keyThe name of the environment variable.
Returns
On success, 0. On failure, returns ERR and errno is set.

Definition at line 127 of file env.c.

Here is the call graph for this function:
Here is the caller graph for this function: