-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcpy_vars.c
32 lines (29 loc) · 1.19 KB
/
cpy_vars.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* cpy_vars.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mdiouf <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/10/06 17:23:43 by mdiouf #+# #+# */
/* Updated: 2014/11/14 16:04:44 by mdiouf ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_minishell1.h"
void cpy_env(char **envp, t_main *vars)
{
int i;
i = 0;
vars->split_args = NULL;
vars->paths = NULL;
while (envp[i] != '\0')
i++;
vars->env = (char**)malloc(sizeof(char*) * (i + 1));
i = 0;
while (envp[i] != '\0')
{
vars->env[i] = ft_strdup(envp[i]);
i++;
}
vars->env[i] = NULL;
}