minishell/srcs/cmd_env.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/26 15:20:58 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
static void put_env(t_env *env)
{
t_env *it;
it = env;
while (it)
{
ft_printf("%s=", it->key);
if (it->val)
ft_printf("%s", it->val);
ft_putchar('\n');
it = it->next;
}
}
int cmd_env(char** argv, t_env** env)
{
if (!argv[1])
put_env(*env);
return (0);
}