forked from mohamedamine456/MiniShell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminishell.c
39 lines (36 loc) · 1.48 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* minishell.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mlachheb <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/03/29 15:03:49 by mlachheb #+# #+# */
/* Updated: 2021/06/29 13:30:53 by mlachheb ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
int main(int argc, char **argv, char **envp)
{
char **new_envp;
if (argc == 1 && argv != NULL && envp != NULL)
{
new_envp = ft_dup_env(envp);
write(1, "\e[1;1H\e[2J", 11);
g_data = init_general_data();
signal_handler();
while (TRUE)
{
g_data.command_line = read_line("MiniShell $> ");
if (g_data.command_line != NULL
&& ft_strcmp(g_data.command_line, ""))
{
g_data.retv = parse_execute(ft_strdup(g_data.command_line),
&new_envp, g_data.retv);
write_hist(&g_data, ft_strdup(g_data.command_line));
free(g_data.command_line);
}
}
}
return (0);
}