maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
env.h
Go to the documentation of this file.
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* env.h :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: dmdemirk <dmdemirk@student.42london.c +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2024/06/07 17:20:26 by dmdemirk #+# #+# */
9/* Updated: 2024/09/06 12:32:33 by dmdemirk ### ########.fr */
10/* */
11/* ************************************************************************** */
12
13#ifndef ENV_H
14# define ENV_H
15
16typedef struct s_env
17{
18 char *key;
19 char *value;
20 struct s_env *next;
22
23/* env */
24void init_env(t_env **data_envp, char **envp);
25void add_env_node(t_env **data_envp, char *line);
26char *get_env(t_env *envp, const char *key);
27void set_env(t_env **env, const char *key, const char *value);
28int unset_env(t_env **env, const char *name);
29
30/* utils */
31char **env_to_array(t_env *envp);
32char *ft_strcdup(const char *s, int c);
33void free_env(t_env *envp);
34void print_t_env(t_env *tokens);
35
36/* shell variables */
37int handle_add_set_shell_variable(t_env **shell_var, char *line);
38
39/* shell variables utils */
40void set_shell_var(t_env **shell_var, const char *key, const char *value);
41void add_shell_var_node(t_env **shell_var, const char *line);
42char *get_shell_variable(t_env *shell_var, const char *key);
43
44#endif
int unset_env(t_env **env, const char *name)
Definition env.c:96
void set_env(t_env **env, const char *key, const char *value)
Definition env.c:73
char ** env_to_array(t_env *envp)
Definition utils.c:23
void init_env(t_env **data_envp, char **envp)
Definition env.c:24
void free_env(t_env *envp)
Definition utils.c:73
char * get_env(t_env *envp, const char *key)
Definition env.c:59
void set_shell_var(t_env **shell_var, const char *key, const char *value)
char * get_shell_variable(t_env *shell_var, const char *key)
char * ft_strcdup(const char *s, int c)
Definition utils.c:52
void print_t_env(t_env *tokens)
Definition utils.c:89
int handle_add_set_shell_variable(t_env **shell_var, char *line)
void add_env_node(t_env **data_envp, char *line)
Definition env.c:33
struct s_env t_env
void add_shell_var_node(t_env **shell_var, const char *line)
Definition env.h:17
struct s_env * next
Definition env.h:20
char * key
Definition env.h:18
char * value
Definition env.h:19