-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
43 lines (39 loc) · 1.47 KB
/
main.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
39
40
41
42
43
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jemartel <jemartel@student.42quebec> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/14 18:48:26 by jemartel #+# #+# */
/* Updated: 2022/02/08 17:53:02 by jemartel ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
#include "signal.h"
#include "fcntl.h"
t_exec g_state = {0};
int main(int argc, char **argv, char **envp)
{
int fd;
create_env(envp);
create_export(envp);
g_state.stdin = dup(0);
g_state.stdout = dup(1);
g_state.error = 0;
g_state.output = 0;
if (argc == 3 && ft_strncmp("-c", argv[1], ft_strlen("-c")) == 0)
{
fd = open("/tmp/here_docced", O_TRUNC | O_CREAT | O_RDWR, 0644);
close(fd);
quick_parser(argv[2]);
freelist(g_state.env);
freelist(g_state.exprt);
}
else
{
fd = open("/tmp/here_docced", O_TRUNC | O_CREAT | O_RDWR, 0644);
close(fd);
igntion_seq();
}
}