-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminishell.c
44 lines (41 loc) · 1.43 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
42
43
44
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* minishell.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hbouhsis <hbouhsis@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/12 10:53:58 by zmeribaa #+# #+# */
/* Updated: 2022/06/06 18:53:49 by hbouhsis ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void exit_shell(void)
{
ft_putendl_fd("exit", STDERR_FILENO);
exit(g_mini.exit_code);
}
int main(int ac, char **av, char **env)
{
ac = 0;
av = 0;
g_mini.envlist = env_builder(env);
while (1)
{
free_all();
catch_signal();
g_mini.line = readline("UnToutPetitShell👼 :");
if (g_mini.line == NULL)
exit_shell();
if (g_mini.line[0] == '\0')
continue ;
add_history(g_mini.line);
parse();
if (!g_mini.l_err && g_mini.command)
{
implement_heredoc();
pipeline_execution(&g_mini.envlist);
unlink_heredocs();
}
}
}