fix: remove multiple redirection

This commit is contained in:
Camille Chauvet
2023-03-20 13:18:20 +01:00
parent 96696243d0
commit d56aac4b25
5 changed files with 17 additions and 11 deletions

View File

@ -98,17 +98,16 @@ int ft_cmds_parser(t_data *data, const char *line)
i = 0;
while (tab[i] != NULL)
{
if (ft_cmd_parser(data, tab[i]))
{
ft_freer_tab_ultimate(1, tab);
return (1);
}
ft_cmd_parser(data, tab[i]);
i++;
}
if (((t_cmd *) (*data->cmds)->content)->fd_in[0] == -1)
((t_cmd *) (*data->cmds)->content)->fd_in[0] = 0;
if (((t_cmd *) (ft_lstlast(*data->cmds))->content)->fd_out[0] == -1)
(((t_cmd *) (ft_lstlast(*data->cmds))->content)->fd_out[0] = 1);
if (*data->cmds != NULL)
{
if (((t_cmd *) (*data->cmds)->content)->fd_in[0] == -1)
((t_cmd *) (*data->cmds)->content)->fd_in[0] = 0;
if (((t_cmd *) (ft_lstlast(*data->cmds))->content)->fd_out[0] == -1)
(((t_cmd *) (ft_lstlast(*data->cmds))->content)->fd_out[0] = 1);
}
ft_freer_tab_ultimate(1, tab);
return (0);
}