🔨」 fix: heredoc not fucking up parsing

This commit is contained in:
2024-07-20 17:55:42 +02:00
parent 59cc4d7011
commit 0018fae334
5 changed files with 20 additions and 15 deletions

View File

@ -6,7 +6,7 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/25 12:20:26 by adjoly #+# #+# */
/* Updated: 2024/07/18 18:23:14 by adjoly ### ########.fr */
/* Updated: 2024/07/20 17:06:30 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -33,7 +33,7 @@ typedef enum s_quote
DOUBLE = 34
} t_quote;
t_cmd *get_redir_fd(void *content);
t_cmd *get_redir_fd(void *content, t_list *tmp);
t_list *get_cmd_list(t_list *list);
void open_redir(t_redirection *redir, t_cmd *cmd, t_redir_sign sign[2]);

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/18 20:14:15 by adjoly #+# #+# */
/* Updated: 2024/07/04 16:50:24 by adjoly ### ########.fr */
/* Updated: 2024/07/20 16:52:51 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -15,7 +15,7 @@
# include "libft.h"
typedef enum s_redirection_sign
typedef enum s_redir_sign
{
INFILE,
HEREDOC,

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/31 12:47:13 by adjoly #+# #+# */
/* Updated: 2024/07/13 14:08:31 by adjoly ### ########.fr */
/* Updated: 2024/07/20 17:11:41 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -21,7 +21,8 @@ t_list *make_lst(t_list *tmp)
cmd_list = malloc(sizeof(t_list));
get_list2(&cmd_list);
cmd_list->next = NULL;
cmd_list->content = get_redir_fd(tmp->content);
cmd_list->content = get_redir_fd(tmp->content, \
((t_token *)tmp->content)->redirection);
return (cmd_list);
}
@ -40,7 +41,8 @@ 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)));
ft_lstadd_back(&cmd_list, ft_lstnew(get_redir_fd(tmp->content, \
((t_token *)tmp->content)->redirection)));
if (!ft_lstlast(cmd_list)->content)
{
ft_lstclear(&cmd_list, &free_cmd);

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/30 10:48:41 by adjoly #+# #+# */
/* Updated: 2024/07/14 15:11:26 by adjoly ### ########.fr */
/* Updated: 2024/07/20 17:16:57 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,17 +18,16 @@
#include <stdio.h>
#include "libft.h"
t_cmd *get_redir_fd(void *content)
t_cmd *get_redir_fd(void *content, t_list *tmp)
{
t_list *tmp;
t_redir_sign sign[2];
t_cmd *cmd;
tmp = ((t_token *)content)->redirection;
cmd = NULL;
sign[0] = INFILE;
sign[1] = OUTFILE;
cmd = ft_calloc(sizeof(t_cmd), 1);
if (!cmd)
return (NULL);
while (tmp)
{
open_redir((t_redirection *)tmp->content, cmd, sign);

View File

@ -6,7 +6,7 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/04 15:00:32 by adjoly #+# #+# */
/* Updated: 2024/07/18 13:02:26 by adjoly ### ########.fr */
/* Updated: 2024/07/20 17:49:22 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -19,10 +19,14 @@ t_cmd *split_cmd(char *cmd_av, t_cmd *cmd)
split = split_argv(cmd_av);
if (!split)
return (NULL);
{
cmd->argv = NULL;
cmd->cmd = NULL;
return (cmd);
}
cmd->cmd = ft_strdup(*split);
if (!cmd->cmd)
return (NULL);
return (cmd);
cmd->argv = split;
return (cmd);
}