diff options
Diffstat (limited to 'src/e_externs_next.c')
-rw-r--r-- | src/e_externs_next.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/e_externs_next.c b/src/e_externs_next.c index e33405c..bbd9d81 100644 --- a/src/e_externs_next.c +++ b/src/e_externs_next.c @@ -19,6 +19,7 @@ #include "s_destroy.h" #include "s_lcom.h" #include "s_struct.h" +#include "u_utils.h" static char *get_fullpath(const char p_path[], @@ -47,7 +48,6 @@ char char *envpath[], t_msh *msh) { - /* TODO: norme */ struct dirent *ent; char **p_path; char *fullpath; @@ -78,18 +78,19 @@ char char **get_env_path(t_msh *msh) { - char **p_env; + size_t i; + char **env_dup; char **envpath; char *envline; - p_env = msh->envp; - while (*p_env && ft_strncmp("PATH", *p_env, 4) != 0) - { - p_env++; - } - if (*p_env == NULL) + env_dup = u_get_env_var_names(msh); + i = 0; + while (env_dup[i] && ft_strncmp("PATH", env_dup[i], 5) != 0) + i++; + if (env_dup[i] == NULL) return (NULL); - envline = ft_strchr(*p_env, '='); + ft_delwords(env_dup); + envline = ft_strchr(msh->envp[i], '='); envline += 1; if (*envline != '\0') { |