diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-05 23:05:03 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-05 23:05:03 +0200 |
commit | f7b13a353092017e37045344528c985172eafc3a (patch) | |
tree | c0bf8c6e8611cb72055f6a65634d1d0d35d6c4d8 /src/b_unset.c | |
parent | New utils functions (diff) | |
download | 42-minishell-f7b13a353092017e37045344528c985172eafc3a.tar.gz 42-minishell-f7b13a353092017e37045344528c985172eafc3a.tar.bz2 42-minishell-f7b13a353092017e37045344528c985172eafc3a.tar.xz 42-minishell-f7b13a353092017e37045344528c985172eafc3a.tar.zst 42-minishell-f7b13a353092017e37045344528c985172eafc3a.zip |
Vars are fixed and finished
Diffstat (limited to 'src/b_unset.c')
-rw-r--r-- | src/b_unset.c | 9 |
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); } |