diff options
| author | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
|---|---|---|
| committer | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
| commit | 967be9e750221ab2ab783f95df79bb26d290a45e (patch) | |
| tree | 6802900a5e975f9f68b169f0f503f040056d6952 /42sh/src/utils/env.h | |
Diffstat (limited to '42sh/src/utils/env.h')
| -rw-r--r-- | 42sh/src/utils/env.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/42sh/src/utils/env.h b/42sh/src/utils/env.h new file mode 100644 index 0000000..e349651 --- /dev/null +++ b/42sh/src/utils/env.h @@ -0,0 +1,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 */ |
