-
Notifications
You must be signed in to change notification settings - Fork 0
/
minishell.c
41 lines (39 loc) · 1.35 KB
/
minishell.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* minishell.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hgrissen <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/15 20:39:02 by hgrissen #+# #+# */
/* Updated: 2021/11/16 22:41:51 by hgrissen ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
int main(int ac, char **av, char **env)
{
g_exe.pids_sig = 0;
(void)av;
init_envs(env);
if (ac == 1)
{
while (TRUE)
{
refresh_bash();
catch_the_signal();
g_exe.line = readline("BASH$>: ");
if (g_exe.line == NULL)
{
ft_putstr_fd("exit\n", 1);
exit (0);
}
if (g_exe.line[0] == '\0')
continue ;
add_history(g_exe.line);
parse();
if (g_exe.cmd && g_exe.lexer_err == 0)
execute_pipe(g_exe.cmd);
}
}
return (0);
}