-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.c
More file actions
54 lines (47 loc) · 1.45 KB
/
Copy pathmain.c
File metadata and controls
54 lines (47 loc) · 1.45 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: shebaz <shebaz@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/25 00:12:31 by shebaz #+# #+# */
/* Updated: 2024/12/20 05:09:40 by shebaz ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
struct s_global *g_var = NULL;
void initialisation(char **envp)
{
initiale_global(init_env(envp));
}
void error_malloc(void)
{
perror("malloc");
exit(EXIT_FAILURE);
}
t_envi *init_env(char **en)
{
t_envi *env_list;
char *env_entry;
int i;
env_list = NULL;
i = 0;
while (en[i])
{
env_entry = ft_strdup(en[i]);
if (!env_entry)
error_strdup();
process_env_entry(env_entry, &env_list);
i++;
}
return (env_list);
}
int main(int argc, char **argv, char **en)
{
(void)argc;
(void)argv;
initialisation(en);
shell_loop(g_var->envp);
return (0);
}