diff options
Diffstat (limited to 'src/env.c')
| -rw-r--r-- | src/env.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -6,11 +6,14 @@ /* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/17 14:31:07 by chuhlig #+# #+# */ -/* Updated: 2024/10/17 15:18:44 by chuhlig ### ########.fr */ +/* Updated: 2024/10/25 19:17:54 by chuhlig ### ########.fr */ /* */ /* ************************************************************************** */ #include "env.h" +#include "get_next_line.h" +#include "libft.h" +#include <stdlib.h> void getenvlst(t_env **env, char **en) { @@ -47,4 +50,15 @@ void free_envlst(t_env **env) free(cur); cur = new; } -}
\ No newline at end of file +} + +char *env_get(t_env *env, char *name) +{ + while (env != NULL) + { + if (!ft_strncmp(env->name, name, ft_strlen(name))) + return (env->value); + env = env->next; + } + return (NULL); +} |
