norminette parse string
This commit is contained in:
parent
5f30d2b650
commit
2059f7d634
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* expander_parse_string.c :+: :+: */
|
||||
/* +:+ */
|
||||
/* By: qmennen <qmennen@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2025/02/18 19:00:35 by qmennen #+# #+# */
|
||||
/* Updated: 2025/02/26 16:13:40 by whaffman ######## odam.nl */
|
||||
/* ::: :::::::: */
|
||||
/* expander_parse_string.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/18 19:00:35 by qmennen #+# #+# */
|
||||
/* Updated: 2025/02/26 18:33:41 by qmennen ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -37,17 +37,16 @@ char *expander_parse_string(char *s, t_minishell *msh)
|
||||
|
||||
variables = expander_parse_variables(s, msh);
|
||||
string = expander_allocate_memory(msh, s, variables);
|
||||
current = variables;
|
||||
i = 0;
|
||||
j = 0;
|
||||
current = variables;
|
||||
while (s[i])
|
||||
while (s[i] && current)
|
||||
{
|
||||
if (s[i] == '$' && s[i + 1])
|
||||
{
|
||||
i++;
|
||||
i += expander_expand_dollar(s + i, string, &j, current);
|
||||
if (current)
|
||||
current = current->next;
|
||||
current = current->next;
|
||||
}
|
||||
else
|
||||
string[j++] = s[i++];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user