This commit is contained in:
tom moron
2024-02-29 15:33:31 +01:00
parent 08debcb6f2
commit 25d81d04e2

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */ /* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/09 15:24:36 by tomoron #+# #+# */ /* Created: 2024/02/09 15:24:36 by tomoron #+# #+# */
/* Updated: 2024/02/18 12:41:23 by tomoron ### ########.fr */ /* Updated: 2024/02/29 15:31:25 by tomoron ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -28,6 +28,8 @@ int get_var_len(char **command, t_env *env)
char *env_var; char *env_var;
(*command)++; (*command)++;
if(**command == '\'' || **command == '"')
return(1);
if (!ft_isalnum(**command) && **command != '_' && **command != '?') if (!ft_isalnum(**command) && **command != '_' && **command != '?')
return (2); return (2);
if (**command == '?') if (**command == '?')
@ -93,6 +95,12 @@ int add_var_to_str(char *res, char **command, t_env *env)
int i; int i;
i = 0; i = 0;
if(**command == '\'' || **command == '"')
{
*res = '$';
(*command)--;
return(1);
}
if (!ft_isalnum(**command) && **command != '_' && **command != '?') if (!ft_isalnum(**command) && **command != '_' && **command != '?')
{ {
res[0] = '$'; res[0] = '$';