fix: only parse dqword with $
This commit is contained in:
parent
ce2c50e753
commit
5f30d2b650
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* parser_get_arguments.c :+: :+: */
|
||||
/* +:+ */
|
||||
/* By: qmennen <qmennen@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2025/02/11 16:20:09 by qmennen #+# #+# */
|
||||
/* Updated: 2025/02/26 16:14:14 by whaffman ######## odam.nl */
|
||||
/* ::: :::::::: */
|
||||
/* parser_get_arguments.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/11 16:20:09 by qmennen #+# #+# */
|
||||
/* Updated: 2025/02/26 18:35:27 by qmennen ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -38,7 +38,7 @@ static int parser_should_expand(t_list *value)
|
||||
token = (t_token *)value->content;
|
||||
if (!token)
|
||||
return (0);
|
||||
return (token->type == T_DQWORD
|
||||
return ((token->type == T_DQWORD && ft_strchr(token->value, '$'))
|
||||
|| (token->type == T_WORD
|
||||
&& token->value[0] == '$'
|
||||
&& token->value[1]));
|
||||
@ -60,8 +60,7 @@ char **parser_get_arguments(t_list *list, t_minishell *msh)
|
||||
if (parser_should_expand(current))
|
||||
args[i] = expander_parse_string(
|
||||
((t_token *)current->content)->value, msh);
|
||||
else if (((t_token *)current->content)->type == T_WORD
|
||||
|| ((t_token *)current->content)->type == T_SQWORD)
|
||||
else if (((t_token *)current->content)->type < 3)
|
||||
args[i] = ft_strdup_safe(msh,
|
||||
((t_token *)current->content)->value);
|
||||
current = current->next;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user