Browse Source

fix empty var

master
narnaud 3 years ago
parent
commit
7b0c1bc630
  1. 10
      lexer_2.c

10
lexer_2.c

@ -6,7 +6,7 @@
/* By: mea <mea@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/16 07:53:17 by narnaud #+# #+# */
/* Updated: 2022/05/17 15:41:41 by mea ### ########.fr */
/* Updated: 2022/05/18 14:44:03 by narnaud@stude ### ########.fr */
/* */
/* ************************************************************************** */
@ -73,7 +73,13 @@ char *get_var_value(t_datas *datas, char *line, int name_len)
{
env = ft_split(datas->envp[i], '=');
if (!ft_strncmp(name, env[0], name_len + 1))
value = (free(env[0]), env[1]);
{
if (env[1])
value = env[1];
else
value = ft_strdup("");
free(env[0]);
}
else if (++i)
ft_free_split(env);
}

Loading…
Cancel
Save