mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
parsing: fix redir accepting operators as specifiers
before: $ >>>>> minishell: syntax error near unexpected token `newline' after: $ >>>>> minishell: syntax error near unexpected token `>>' >> is now correctly detected as an operator, and not a word
This commit is contained in:
parent
9593851149
commit
84a246f6f6
1 changed files with 6 additions and 4 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/04/15 10:13:58 by khais #+# #+# */
|
/* Created: 2025/04/15 10:13:58 by khais #+# #+# */
|
||||||
/* Updated: 2025/04/16 12:58:04 by khais ### ########.fr */
|
/* Updated: 2025/04/16 13:56:59 by khais ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -32,10 +32,12 @@ t_redirect *minishell_redirect_parse(t_minishell *app, t_wordlist **tokens)
|
||||||
if ((*tokens) == NULL)
|
if ((*tokens) == NULL)
|
||||||
{
|
{
|
||||||
worddesc_destroy(redir_operator);
|
worddesc_destroy(redir_operator);
|
||||||
ft_errno(FT_EERRNO);
|
return (ft_errno(FT_EERRNO), redirect_destroy(redir_list), NULL);
|
||||||
return (redirect_destroy(redir_list), NULL);
|
|
||||||
}
|
}
|
||||||
redir_specifier = wordlist_pop(tokens);
|
if ((*tokens)->word->token_type == WORD_TOKEN)
|
||||||
|
redir_specifier = wordlist_pop(tokens);
|
||||||
|
else
|
||||||
|
return (ft_errno(FT_EERRNO), redirect_destroy(redir_list), NULL);
|
||||||
new_redir = redir_from_words(redir_operator, redir_specifier, app);
|
new_redir = redir_from_words(redir_operator, redir_specifier, app);
|
||||||
t_redirect_add_back(&redir_list, new_redir);
|
t_redirect_add_back(&redir_list, new_redir);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue