-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.c
40 lines (37 loc) · 1.36 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ibnada <ibnada@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/07 15:26:32 by obouizga #+# #+# */
/* Updated: 2022/11/15 21:03:09 by ibnada ### ########.fr */
/* */
/* ************************************************************************** */
#include "./Header/minishell.h"
int main(int ac, char **av, char **env)
{
t_cmdl *cmd_line;
int fd;
int fd1;
(void)ac;
(void)av;
fd = dup(0);
fd1 = dup(1);
setup(env);
while (1)
{
g_shell.in_heredoc = 0;
g_shell.here_sigint = 0;
g_shell.prs_error = 0;
handle_signals(before_readline_handle);
cmd_line = parser();
handle_signals(after_readline_handle);
execute(cmd_line, env);
free_cmdl_lst(&cmd_line);
dup2(fd, STDIN_FILENO);
dup2(fd1, STDOUT_FILENO);
}
return (0);
}