minishell/src/enviroment/parse_enviroment.c

31 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* :::::::: */
/* parse_enviroment.c :+: :+: */
/* +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/02/05 15:52:33 by whaffman #+# #+# */
/* Updated: 2025/02/05 15:52:34 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
#include "minishell.h"
int parse_enviroment(char **envp, t_enviroment **enviroment)
{
char **env;
*enviroment = NULL;
if (envp == NULL)
return (FAILURE);
while (*envp != NULL)
{
env = ft_split(*envp, '=');
add_enviroment(enviroment, env[0], env[1]);
ft_free_arr(env);
envp++;
}
return (SUCCESS);
}