diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-23 21:34:39 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-23 21:34:39 +0200 |
commit | 9ae0c7294c4fb7eaeec6feca76327939ee8cd8e1 (patch) | |
tree | 61dffc8459616c029984a803f2edf2573cc6ae6e /src/ft_u_utils.c | |
parent | On the way (diff) | |
download | 42-minishell-9ae0c7294c4fb7eaeec6feca76327939ee8cd8e1.tar.gz 42-minishell-9ae0c7294c4fb7eaeec6feca76327939ee8cd8e1.tar.bz2 42-minishell-9ae0c7294c4fb7eaeec6feca76327939ee8cd8e1.tar.xz 42-minishell-9ae0c7294c4fb7eaeec6feca76327939ee8cd8e1.tar.zst 42-minishell-9ae0c7294c4fb7eaeec6feca76327939ee8cd8e1.zip |
Good work so far
Diffstat (limited to '')
-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 |