-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
51 lines (45 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
44
45
46
47
48
49
50
51
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: khermann <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/04/20 00:15:32 by khermann #+# #+# */
/* Updated: 2021/04/20 00:15:34 by khermann ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void minishell(t_sh *sh)
{
struct termios t;
while (sh->running)
{
check_term();
set_input_mode(&t);
parser(sh);
unset_input_mode(&t);
if (sh->ret_val == 0 && sh->check_null == 0)
executor(sh);
else
g_exitsig = 258;
free_args(sh);
free_cmd(sh);
sh->ret_val = 0;
sh->check_null = 0;
}
}
int g_exitsig = 0;
int main(int argc, char **argv, char **envp)
{
t_sh sh;
(void)argc;
(void)argv;
setbuf(stdout, 0);
signal(SIGINT, sig_handle);
signal(SIGQUIT, sig_handle);
signal(SIGTERM, sig_handle);
shell_init(&sh, envp);
minishell(&sh);
return (0);
}