」 feat: Added ctrl c to heredoc

This commit is contained in:
2024-07-13 14:16:31 +02:00
parent 310f26ef80
commit d7c5e9611b
18 changed files with 183 additions and 521 deletions

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/31 12:47:13 by adjoly #+# #+# */
/* Updated: 2024/07/10 01:12:52 by adjoly ### ########.fr */
/* Updated: 2024/07/13 14:08:31 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -14,20 +14,40 @@
#include "parsing.h"
#include "minishell.h"
t_list *make_lst(t_list *tmp)
{
t_list *cmd_list;
cmd_list = malloc(sizeof(t_list));
get_list2(&cmd_list);
cmd_list->next = NULL;
cmd_list->content = get_redir_fd(tmp->content);
return (cmd_list);
}
t_list *get_cmd_list(t_list *list)
{
t_list *tmp;
t_list *cmd_list;
tmp = list;
cmd_list = malloc(sizeof(t_list));
get_list2(&cmd_list);
cmd_list->next = NULL;
cmd_list->content = get_redir_fd(tmp->content);
cmd_list = make_lst(tmp);
if (!cmd_list->content)
{
free(cmd_list);
return (NULL);
}
tmp = tmp->next;
while (tmp)
{
ft_lstadd_back(&cmd_list, ft_lstnew(get_redir_fd(tmp->content)));
if (!ft_lstlast(cmd_list)->content)
{
ft_lstclear(&cmd_list, &free_cmd);
if (cmd_list)
free(cmd_list);
return (NULL);
}
tmp = tmp->next;
}
return (cmd_list);