From fd72fbb0d31d9742f17022569b1abe7a9d3a36d6 Mon Sep 17 00:00:00 2001 From: Quinten Date: Sun, 23 Feb 2025 13:11:06 +0100 Subject: [PATCH] general fixes to redirects --- src/parser/parser_get_commands.c | 2 +- src/redirect/redirect_get_inputs.c | 2 ++ src/redirect/redirect_get_outputs.c | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/parser/parser_get_commands.c b/src/parser/parser_get_commands.c index 6725b8c..cbf115e 100644 --- a/src/parser/parser_get_commands.c +++ b/src/parser/parser_get_commands.c @@ -14,7 +14,7 @@ static int is_command_token(t_token *token) { - return (token->type < 3 || redirect_token_type(token)); + return (token->type < 3 || token->type == T_REDIRECT_IN || token->type ==T_HEREDOC || token->type == T_REDIRECT_OUT || token->type == T_APPEND_OUT); } t_list *parser_get_commands(t_minishell *minishell) diff --git a/src/redirect/redirect_get_inputs.c b/src/redirect/redirect_get_inputs.c index 1ea9f8b..a44a6fe 100644 --- a/src/redirect/redirect_get_inputs.c +++ b/src/redirect/redirect_get_inputs.c @@ -23,6 +23,8 @@ t_list *redirect_get_inputs(t_list *list) while (current) { token = (t_token *)current->content; + if (token->type == T_PIPE || token->type == T_EOF) + break ; if (token->type != T_REDIRECT_IN && token->type != T_HEREDOC) { current = current->next; diff --git a/src/redirect/redirect_get_outputs.c b/src/redirect/redirect_get_outputs.c index 18cc0dc..9383bf6 100644 --- a/src/redirect/redirect_get_outputs.c +++ b/src/redirect/redirect_get_outputs.c @@ -23,6 +23,8 @@ t_list *redirect_get_outputs(t_list *list) while (current) { token = (t_token *)current->content; + if (token->type == T_PIPE || token->type == T_EOF) + break; if (token->type != T_REDIRECT_OUT && token->type != T_APPEND_OUT) { current = current->next;