From e2b734cf0cadea69aa8be78c3c1dc5808ba76dce Mon Sep 17 00:00:00 2001 From: Sergio Date: Sat, 14 Feb 2026 05:48:18 +0100 Subject: [PATCH] save commit --- src/minishell.c | 5 +- src/parser/parser_expand.c | 96 ++++++++++++++++++++++++++++++++++---- src/parser/parser_words.c | 2 +- 3 files changed, 90 insertions(+), 13 deletions(-) diff --git a/src/minishell.c b/src/minishell.c index 838a028..ff63d78 100644 --- a/src/minishell.c +++ b/src/minishell.c @@ -6,7 +6,7 @@ /* By: sede-san exit = true, malloc_error()); + } + else + { + toggle_quotes((*argument)[*i], in_single_quote, &in_double_quote); + check_boundaries( + *in_single_quote, in_double_quote, quote_boundaries, *i); + (*i)++; + } + } + if (*in_single_quote || in_double_quote) + return (syntax_error_unexpected_token(NULL)); + return (remove_quotes( + argument, quote_boundaries[0], quote_boundaries[1], *i)); +} + static void expand_argument( char **argument, t_minishell *minishell ) { bool in_single_quote; - bool in_double_quote; int i; in_single_quote = false; - in_double_quote = false; i = 0; while ((*argument)[i] != '\0') { @@ -86,13 +168,7 @@ static void expand_argument( return (minishell->exit = true, malloc_error()); } else - { - if ((*argument)[i] == '\'' && !in_double_quote) - in_single_quote = !in_single_quote; - else if ((*argument)[i] == '"' && !in_single_quote) - in_double_quote = !in_double_quote; - i++; - } + handle_quotes(argument, &i, &in_single_quote, minishell); } } diff --git a/src/parser/parser_words.c b/src/parser/parser_words.c index e589ec2..bff78e5 100644 --- a/src/parser/parser_words.c +++ b/src/parser/parser_words.c @@ -6,7 +6,7 @@ /* By: sede-san