altered env. Added dummy function for cd, echo, setenv & unsetenv Started work on env copy feature
36 lines
1.2 KiB
C
36 lines
1.2 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* 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);
|
|
}
|