-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathminishell.c
More file actions
48 lines (44 loc) · 1.55 KB
/
Copy pathminishell.c
File metadata and controls
48 lines (44 loc) · 1.55 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* minishell.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: TheTerror <jfaye@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/08 15:49:13 by TheTerror #+# #+# */
/* Updated: 2023/11/03 14:27:20 by lmohin ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
t_bool ft_minishell(t_vars *v);
t_bool ft_prompt(t_vars *v)
{
set_readline_signals();
v->line = readline("minishell$ ");
while (v->line)
{
if ((v->line)[0])
add_history(v->line);
ft_minishell(v);
ft_clear_created_tempfiles(v);
if ((v->line)[0])
ft_freecommands(v);
ft_raz(v);
ft_freestr(&v->line);
v->line = readline("minishell$ ");
}
ft_freestr(&v->line);
ft_putendl_fd("exit", STDOUT_FILENO);
return (__TRUE);
}
t_bool ft_minishell(t_vars *v)
{
v->commands = get_commands(v);
if (!v->commands)
return (__FALSE);
if (v->flg_parsing_is_ok == __FALSE)
return (__FALSE);
if (!ft_launcher(v))
return (__FALSE);
return (__TRUE);
}