This commit is contained in:
Etienne Rey-bethbeder 2023-04-14 19:14:31 +02:00
parent 0b56e95868
commit b502364a67

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */ /* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/14 14:27:08 by cchauvet #+# #+# */ /* Created: 2023/02/14 14:27:08 by cchauvet #+# #+# */
/* Updated: 2023/04/04 13:38:27 by erey-bet ### ########.fr */ /* Updated: 2023/04/14 19:12:10 by erey-bet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -31,17 +31,20 @@ void print_export(t_list **env, int fd)
current = *env; current = *env;
while (current->next != NULL) while (current->next != NULL)
{ {
write(fd, "declare -x ", 11); if (ft_strcmp(((t_env *)(current->content))->key, "_"))
ft_putstr_fd(((t_env *)(current->content))->key, fd);
if (((t_env *)(current->content))->value != NULL)
{ {
ft_putstr_fd("=", fd); write(fd, "declare -x ", 11);
write(fd, "\"", 1); ft_putstr_fd(((t_env *)(current->content))->key, fd);
ft_putstr_fd(((t_env *)(current->content))->value, fd); if (((t_env *)(current->content))->value != NULL)
write(fd, "\"\n", 2); {
ft_putstr_fd("=", fd);
write(fd, "\"", 1);
ft_putstr_fd(((t_env *)(current->content))->value, fd);
write(fd, "\"\n", 2);
}
else
write(fd, "\n", 2);
} }
else
write(fd, "\n", 2);
current = current->next; current = current->next;
} }
} }