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_export_next.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_export_next.c')
-rw-r--r-- | src/b_export_next.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/b_export_next.c b/src/b_export_next.c index 0a56968..7b70047 100644 --- a/src/b_export_next.c +++ b/src/b_export_next.c @@ -17,6 +17,7 @@ #include "f_fail.h" #include "s_lvars.h" #include "s_struct.h" +#include "u_utils.h" #include "u_vars.h" static char @@ -46,17 +47,20 @@ static int64_t b_is_it_in_env(const char varname[], t_msh *msh) { - char **p_env; + char **env_dup; + size_t i; - p_env = msh->envp; - while (*p_env != NULL) + env_dup = u_get_env_var_names(msh); + i = 0; + while (env_dup[i] != NULL) { - if (ft_strncmp(varname, *p_env, ft_strclen(*p_env, '=')) == 0) + if (ft_strncmp(varname, env_dup[i], ft_strlen(env_dup[i]) + 1) == 0) { - return (p_env - msh->envp); + return (i); } - p_env++; + i++; } + ft_delwords(env_dup); return (-1); } |