-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexport_utils4.c
38 lines (35 loc) · 1.33 KB
/
export_utils4.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* export_utils4.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mazaroua <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/05 12:43:04 by abenheni #+# #+# */
/* Updated: 2023/05/13 10:45:44 by mazaroua ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void append_env(t_env_list **env_list, char *name, char *value)
{
int no_created;
t_env_list *lst;
char *tmp;
lst = (*env_list);
no_created = 0;
while (lst)
{
if (ft_strcmp(lst->name, name) == 0)
{
no_created = 1;
tmp = lst->value;
lst->value = ft_strjoin_export(lst->value, value);
free(tmp);
lst->flag = 0;
break ;
}
lst = lst->next;
}
if (!no_created)
addback_env(env_list, addnew_env(name, value));
}