-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_env_to_tab.c
35 lines (32 loc) · 1.2 KB
/
ft_env_to_tab.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_env_to_tab.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: abenamar <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/09/09 21:31:01 by abenamar #+# #+# */
/* Updated: 2023/09/11 18:24:42 by abenamar ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
char **ft_env_to_tab(t_list *lst)
{
char **tab;
size_t i;
tab = malloc(ft_lstsize(lst) * sizeof(char *));
if (!tab)
return (NULL);
i = 0;
while (lst)
{
if (ft_strncmp(lst->content, "?=", 2))
{
tab[i] = ft_strdup(lst->content);
++i;
}
lst = lst->next;
}
tab[i] = NULL;
return (tab);
}