summaryrefslogtreecommitdiffstats
path: root/src/b_export_next.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/b_export_next.c')
-rw-r--r--src/b_export_next.c16
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);
}