added basic env & setenv commands

This commit is contained in:
Tanguy MAZE
2019-01-13 19:03:08 +01:00
parent b60be696b0
commit 36d7fc342d
10 changed files with 228 additions and 24 deletions

View File

@@ -6,7 +6,7 @@
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/18 13:12:34 by tmaze #+# #+# */
/* Updated: 2019/01/10 13:52:54 by tmaze ### ########.fr */
/* Updated: 2019/01/13 17:03:08 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
@@ -20,7 +20,7 @@
typedef struct s_builtin
{
char *cmd;
int (*f)(char **argv, t_list *env);
int (*f)(char **argv, t_list **env);
} t_builtin;
typedef struct s_envelem
@@ -29,8 +29,17 @@ typedef struct s_envelem
char *val;
} t_envelem;
int exec_cmd(char **argv, t_list *env);
int cmd_echo(char **argv, t_list *env);
int cmd_cd(char **argv, t_list *env);
t_envelem *elem_new(char *key, char *val);
t_envelem *env_getelemfromkey(char *key, t_list *env);
t_envelem *env_addupdate(char *key, char *val, t_list **env);
void env_delelem(char *key, t_list **env);
void ft_lstdelenvelem(void *content, size_t size);
int exec_cmd(char **argv, t_list **env);
int cmd_echo(char **argv, t_list **env);
int cmd_cd(char **argv, t_list **env);
int cmd_env(char **argv, t_list **env);
int cmd_setenv(char **argv, t_list **env);
#endif