From f7b13a353092017e37045344528c985172eafc3a Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Wed, 5 Aug 2020 23:05:03 +0200 Subject: Vars are fixed and finished --- src/b_unset.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/b_unset.c') diff --git a/src/b_unset.c b/src/b_unset.c index 03fd2a8..c45d5ee 100644 --- a/src/b_unset.c +++ b/src/b_unset.c @@ -17,6 +17,7 @@ #include "f_fail.h" #include "s_lvars.h" #include "s_struct.h" +#include "u_utils.h" static t_bool check_valid_identifier(const char arg[]) @@ -82,18 +83,22 @@ static t_bool b_removed_from_env(const char arg[], t_msh *msh) { + char **env_dup; size_t i; + env_dup = u_get_env_var_names(msh); i = 0; - while (msh->envp[i] != NULL) + while (env_dup[i] != NULL) { - if (ft_strncmp(arg, msh->envp[i], ft_strclen(msh->envp[i], '=')) == 0) + if (ft_strncmp(arg, env_dup[i], ft_strlen(env_dup[i]) + 1) == 0) { b_realloc_env(i, msh); + ft_delwords(env_dup); return (TRUE); } i++; } + ft_delwords(env_dup); return (FALSE); } -- cgit v1.2.3