j'ai remis le is_var, je sais pas a quoi il sert mais mtn il marche (peut-être)
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/02/09 15:26:01 by tomoron #+# #+# */
|
/* 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"
|
#include "minishell.h"
|
||||||
@ -81,10 +81,9 @@ int get_variable_expantion_len(char *command , t_env *env)
|
|||||||
return(i);
|
return(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *expand_variables(char *command, t_env *env)
|
char *expand_variables(char *command, t_env *env, int *is_var)
|
||||||
{
|
{
|
||||||
char *res;
|
char *res;
|
||||||
char *start;
|
|
||||||
int i;
|
int i;
|
||||||
int in_dquote;
|
int in_dquote;
|
||||||
int in_quote;
|
int in_quote;
|
||||||
@ -92,9 +91,9 @@ char *expand_variables(char *command, t_env *env)
|
|||||||
if(!command)
|
if(!command)
|
||||||
return(0);
|
return(0);
|
||||||
res = ft_calloc(get_variable_expantion_len(command, env) + 1, 1);
|
res = ft_calloc(get_variable_expantion_len(command, env) + 1, 1);
|
||||||
start = command;
|
|
||||||
in_quote = 0;
|
in_quote = 0;
|
||||||
in_dquote = 0;
|
in_dquote = 0;
|
||||||
|
*is_var = 1;
|
||||||
i = 0;
|
i = 0;
|
||||||
while(res && *command)
|
while(res && *command)
|
||||||
{
|
{
|
||||||
@ -123,7 +122,7 @@ t_token *parse_tokens(char *command, t_env *env)
|
|||||||
quotes[1] = 0;
|
quotes[1] = 0;
|
||||||
res = 0;
|
res = 0;
|
||||||
is_var = 0;
|
is_var = 0;
|
||||||
command = expand_variables(command, env);
|
command = expand_variables(command, env, &is_var);
|
||||||
tmp = command;
|
tmp = command;
|
||||||
while (command && *command)
|
while (command && *command)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user