diff --git a/libft/Makefile b/libft/Makefile index 56257f8..b4d231d 100644 --- a/libft/Makefile +++ b/libft/Makefile @@ -6,7 +6,7 @@ # By: mmoussou next; - ft_lstdelone(*lst, del); + if ((*lst)->content) + ft_lstdelone(*lst, del); *lst = tmp; } } diff --git a/src/exec/heredoc.c b/src/exec/heredoc.c index 4f2d91a..a86531c 100644 --- a/src/exec/heredoc.c +++ b/src/exec/heredoc.c @@ -6,7 +6,7 @@ /* By: mmoussou +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/10 01:14:10 by adjoly #+# #+# */ -/* Updated: 2024/07/15 17:03:12 by adjoly ### ########.fr */ +/* Updated: 2024/08/01 17:58:58 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -32,13 +32,13 @@ void ft_lstclear_till_nxt(t_list **lst, void (*del)(void *)) { t_list *tmp; + if (!lst || !del) + return ; if (!(*lst)->next) { free(*lst); return ; } - if (!lst || !del) - return ; while (lst && *lst && (*lst)->next && del) { tmp = (*lst)->next; diff --git a/src/parsing/get_cmd_list.c b/src/parsing/get_cmd_list.c index be14e35..90aed11 100644 --- a/src/parsing/get_cmd_list.c +++ b/src/parsing/get_cmd_list.c @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/31 12:47:13 by adjoly #+# #+# */ -/* Updated: 2024/07/20 17:11:41 by adjoly ### ########.fr */ +/* Updated: 2024/08/01 18:07:13 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -41,8 +41,7 @@ t_list *get_cmd_list(t_list *list) tmp = tmp->next; while (tmp) { - ft_lstadd_back(&cmd_list, ft_lstnew(get_redir_fd(tmp->content, \ - ((t_token *)tmp->content)->redirection))); + ft_lstadd_back(&cmd_list, make_lst(tmp)); if (!ft_lstlast(cmd_list)->content) { ft_lstclear(&cmd_list, &free_cmd);