feature: switched env from ft_list to specific list

This commit is contained in:
Tanguy MAZE
2019-09-26 16:54:52 +02:00
parent 05d8424f75
commit aa8e971688
9 changed files with 128 additions and 89 deletions

View File

@@ -6,7 +6,7 @@
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/18 13:12:34 by tmaze #+# #+# */
/* Updated: 2019/09/20 14:36:35 by tmaze ### ########.fr */
/* Updated: 2019/09/26 16:53:31 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
@@ -19,19 +19,28 @@
# define S_BIN 5
typedef struct s_builtin
typedef struct s_env
{
char *cmd;
int (*f)(char **argv, t_list **env);
} t_builtin;
char *key;
char *val;
struct s_env *next;
} t_env;
int cmd_env(char** argv, t_list** env);
int cmd_setenv(char** argv, t_list** env);
int cmd_unsetenv(char** argv, t_list** env);
int cmd_cd(char** argv, t_list** env);
int cmd_echo(char** argv, t_list** env);
typedef struct s_builtin
{
char *cmd;
int (*f)(char **argv, t_env **env);
} t_builtin;
void lstdelenvelem(void *content, size_t size);
t_list *env2lst(char **env);
int cmd_env(char **argv, t_env **env);
int cmd_setenv(char **argv, t_env **env);
int cmd_unsetenv(char **argv, t_env **env);
int cmd_cd(char **argv, t_env **env);
int cmd_echo(char **argv, t_env **env);
void lstdelelem(t_env **elem);
void lstdel(t_env **env);
t_env *lstnew(char *env);
t_env *lstaddend(t_env **alst, t_env *new);
#endif