environment: rename functions environment: add get_arr function builtins: add export builtin
31 lines
1.2 KiB
C
31 lines
1.2 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* :::::::: */
|
|
/* environment_parse.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 environment_parse(char **envp, t_list **environment)
|
|
{
|
|
char **env;
|
|
|
|
*environment = NULL;
|
|
if (envp == NULL)
|
|
return (FAILURE);
|
|
while (*envp != NULL)
|
|
{
|
|
env = ft_split(*envp, '=');
|
|
environment_add(environment, env[0], env[1]);
|
|
ft_free_arr(env);
|
|
envp++;
|
|
}
|
|
return (SUCCESS);
|
|
}
|