25 lines
510 B
C
25 lines
510 B
C
#include "enviroment.h"
|
|
#include "libft.h"
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
|
|
void add_enviroment(t_enviroment **enviroment, char *name, char *value)
|
|
{
|
|
t_enviroment *new_enviroment;
|
|
|
|
if (name != NULL && value != NULL)
|
|
{
|
|
new_enviroment = malloc(sizeof(t_enviroment));
|
|
if (new_enviroment == NULL)
|
|
{
|
|
perror("malloc");
|
|
return ;
|
|
}
|
|
new_enviroment->name = ft_strdup(name);
|
|
new_enviroment->value = ft_strdup(value);
|
|
new_enviroment->next = *enviroment;
|
|
*enviroment = new_enviroment;
|
|
}
|
|
}
|