remise a sa place de env init

This commit is contained in:
Nathan Lebrun
2025-01-20 13:36:43 +01:00
parent b319c2129f
commit 9ee0c5bf2d
3 changed files with 19 additions and 18 deletions

18
srcs/env/var.c vendored
View File

@@ -157,3 +157,21 @@ void set_var_env(char *key, char *value, t_data *data)
free_null_ptr(tmp);
return ;
}
char **init_env(char **envp)
{
char **env;
int i;
i = 0;
env = malloc(sizeof(char *) * (count_var(envp) + 1));
if (!env)
return (NULL);
env[count_var(envp)] = NULL;
while (envp[i])
{
env[i] = ft_strdup(envp[i]);
i++;
}
return (env);
}