summaryrefslogtreecommitdiffstats
path: root/src/b_unset.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/b_unset.c9
1 files changed, 7 insertions, 2 deletions
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);
}