From 257e4829ba1bf8b960985c13ccfabf41158767bc Mon Sep 17 00:00:00 2001 From: tomoron Date: Sat, 4 May 2024 18:32:37 +0200 Subject: [PATCH] =?UTF-8?q?j'ai=20remis=20le=20is=5Fvar,=20je=20sais=20pas?= =?UTF-8?q?=20a=20quoi=20il=20sert=20mais=20mtn=20il=20marche=20(peut-?= =?UTF-8?q?=C3=AAtre)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- srcs/parsing.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/srcs/parsing.c b/srcs/parsing.c index 1afa008..bf063c8 100755 --- a/srcs/parsing.c +++ b/srcs/parsing.c @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/09 15:26:01 by tomoron #+# #+# */ -/* Updated: 2024/05/04 14:30:22 by tomoron ### ########.fr */ +/* Updated: 2024/05/04 18:31:41 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" @@ -81,10 +81,9 @@ int get_variable_expantion_len(char *command , t_env *env) return(i); } -char *expand_variables(char *command, t_env *env) +char *expand_variables(char *command, t_env *env, int *is_var) { char *res; - char *start; int i; int in_dquote; int in_quote; @@ -92,9 +91,9 @@ char *expand_variables(char *command, t_env *env) if(!command) return(0); res = ft_calloc(get_variable_expantion_len(command, env) + 1, 1); - start = command; in_quote = 0; in_dquote = 0; + *is_var = 1; i = 0; while(res && *command) { @@ -123,7 +122,7 @@ t_token *parse_tokens(char *command, t_env *env) quotes[1] = 0; res = 0; is_var = 0; - command = expand_variables(command, env); + command = expand_variables(command, env, &is_var); tmp = command; while (command && *command) {