small fix

This commit is contained in:
Quinten Mennen 2025-02-27 18:59:00 +01:00
parent efd4d3f751
commit 547dacc0ba

View File

@ -6,7 +6,7 @@
/* 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 18:35:27 by qmennen ### ########.fr */ /* Updated: 2025/02/27 18:58:48 by qmennen ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -34,13 +34,23 @@ static int count_cmds(t_list *list)
static int parser_should_expand(t_list *value) static int parser_should_expand(t_list *value)
{ {
t_token *token; t_token *token;
int i;
token = (t_token *)value->content; token = (t_token *)value->content;
if (!token) if (!token)
return (0); return (0);
return ((token->type == T_DQWORD && ft_strchr(token->value, '$')) i = 0;
|| (token->type == T_WORD if (token->type == T_DQWORD)
&& token->value[0] == '$' {
while (token->value[i])
{
if (token->value[i] == '$' && !expander_character_valid(token->value[i + 1]))
return (0);
i++;
}
return (1);
}
return ((token->type == T_WORD && token->value[0] == '$'
&& token->value[1])); && token->value[1]));
} }