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