diff options
Diffstat (limited to 'src/ft_u_utils.c')
-rw-r--r-- | src/ft_u_utils.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/ft_u_utils.c b/src/ft_u_utils.c index 8c61bf9..cd9e53f 100644 --- a/src/ft_u_utils.c +++ b/src/ft_u_utils.c @@ -11,23 +11,28 @@ /* ************************************************************************** */ #include <libft.h> +#include <stdlib.h> #include <stdint.h> #include "ft_s_struct.h" char - *ft_get_home_dir(t_msh *msh) + *ft_get_home_dir(char **envp) { char **ptr; + char *path; - ptr = msh->envp; + ptr = envp; while (*ptr) { - if (ft_strncmp( , , )) + if (ft_strncmp("HOME", *ptr, 4) == 0) { + path = ft_substr(*ptr, 5, ft_strlen(*ptr + 5)); + return (path); } ptr++; } + return (NULL); } uint64_t |