2023-02-14 11:11:39 -05:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* ::: :::::::: */
|
|
|
|
/* env.c :+: :+: :+: */
|
|
|
|
/* +:+ +:+ +:+ */
|
|
|
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
|
|
|
/* +#+#+#+#+#+ +#+ */
|
|
|
|
/* Created: 2023/02/14 14:56:02 by cchauvet #+# #+# */
|
2023-03-09 09:07:36 -05:00
|
|
|
/* Updated: 2023/03/09 15:04:47 by erey-bet ### ########.fr */
|
2023-02-14 11:11:39 -05:00
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#include "../minishell.h"
|
|
|
|
|
2023-02-23 11:19:25 -05:00
|
|
|
int print_env(t_list **env, int fd)
|
2023-02-14 11:11:39 -05:00
|
|
|
{
|
|
|
|
t_list *current;
|
|
|
|
|
2023-02-23 11:19:25 -05:00
|
|
|
current = *env;
|
2023-02-17 11:46:12 -05:00
|
|
|
while (current->next != NULL)
|
2023-02-14 11:11:39 -05:00
|
|
|
{
|
2023-03-09 09:07:36 -05:00
|
|
|
if (((t_env *)(current->content))->original)
|
|
|
|
{
|
|
|
|
ft_putstr_fd(((t_env *)(current->content))->key, fd);
|
|
|
|
ft_putstr_fd("=", fd);
|
|
|
|
ft_putstr_fd(((t_env *)(current->content))->value, fd);
|
|
|
|
write(fd, "\n", 1);
|
|
|
|
}
|
2023-02-14 11:11:39 -05:00
|
|
|
current = current->next;
|
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
}
|
2023-02-23 07:36:26 -05:00
|
|
|
|
|
|
|
/*int main(int argc, char *argv[], char **env)
|
|
|
|
{
|
|
|
|
t_list **be;
|
|
|
|
|
|
|
|
be = init_env(env);
|
|
|
|
print_env(be, 1);
|
|
|
|
return (0);
|
|
|
|
}*/
|