summaryrefslogtreecommitdiff
path: root/42sh/src/utils/env.h
blob: e349651f9a7edb18709f17e383c13619e4325229 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef ENV_H
#define ENV_H

#include <stdlib.h>

#define DEFAULT_IFS " \t\n"

#define MAX_PATH_SIZE 4096
#define MAX_RAND 32768

/**
 * @brief Sets the variable `name`=`value` into the environment.
 */
void env_set(const char *name, const char *value);

/**
 * @brief Unsets the variable `name` from the environment.
 */
void env_unset(const char *name);

/**
 * @brief Gets the value of the variable `name`.
 * @return A string that contains the value.
 */
char *env_get(const char *name);

/**
 * @brief Clears all of the variables that are in the environment.
 */
void env_clear(void);

/**
 * @brief Sets a few variables to default values (that can be found in `env.h`).
 * Here is the list of the variables affected by this function:
 * `PWD`,
 * `OLDPWD`,
 * `IFS`
 */
void env_setup(void);

#endif /* ! ENV_H */