From 967be9e750221ab2ab783f95df79bb26d290a45e Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Mon, 15 Sep 2025 01:07:58 +0200 Subject: add: added projects --- 42sh/src/utils/env.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 42sh/src/utils/env.h (limited to '42sh/src/utils/env.h') 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 + +#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 */ -- cgit v1.2.3