Feat(WIP): Added possibility to cmd_env to execute commands with
altered env. Added dummy function for cd, echo, setenv & unsetenv Started work on env copy feature
This commit is contained in:
35
srcs/cmd_env.c
Normal file
35
srcs/cmd_env.c
Normal file
@@ -0,0 +1,35 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* cmd_env.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/09/20 14:33:48 by tmaze #+# #+# */
|
||||
/* Updated: 2019/09/20 15:02:22 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
static void put_env(t_list *env)
|
||||
{
|
||||
t_list *it;
|
||||
|
||||
it = env;
|
||||
while (it)
|
||||
{
|
||||
ft_printf("%s=", ((char**)it->content)[0]);
|
||||
if (((char**)it->content)[1])
|
||||
ft_printf("%s", ((char**)it->content)[1]);
|
||||
ft_putchar('\n');
|
||||
it = it->next;
|
||||
}
|
||||
}
|
||||
|
||||
int cmd_env(char** argv, t_list** env)
|
||||
{
|
||||
if (!argv[1])
|
||||
put_env(*env);
|
||||
return (0);
|
||||
}
|
Reference in New Issue
Block a user