norminette parse string

This commit is contained in:
Quinten Mennen 2025-02-26 18:36:16 +01:00
parent 5f30d2b650
commit 2059f7d634

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* :::::::: */ /* ::: :::::::: */
/* expander_parse_string.c :+: :+: */ /* expander_parse_string.c :+: :+: :+: */
/* +:+ */ /* +:+ +:+ +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ */ /* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
/* +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/18 19:00:35 by qmennen #+# #+# */ /* Created: 2025/02/18 19:00:35 by qmennen #+# #+# */
/* Updated: 2025/02/26 16:13:40 by whaffman ######## odam.nl */ /* Updated: 2025/02/26 18:33:41 by qmennen ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -37,16 +37,15 @@ char *expander_parse_string(char *s, t_minishell *msh)
variables = expander_parse_variables(s, msh); variables = expander_parse_variables(s, msh);
string = expander_allocate_memory(msh, s, variables); string = expander_allocate_memory(msh, s, variables);
current = variables;
i = 0; i = 0;
j = 0; j = 0;
current = variables; while (s[i] && current)
while (s[i])
{ {
if (s[i] == '$' && s[i + 1]) if (s[i] == '$' && s[i + 1])
{ {
i++; i++;
i += expander_expand_dollar(s + i, string, &j, current); i += expander_expand_dollar(s + i, string, &j, current);
if (current)
current = current->next; current = current->next;
} }
else else