-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexec5.c
48 lines (43 loc) · 1.54 KB
/
exec5.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* exec5.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adel-cor <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/05 12:42:50 by adel-cor #+# #+# */
/* Updated: 2022/04/12 10:25:20 by adel-cor ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
bool is_redirection(struct s_tnode *token)
{
if (token->type == REDIR_L || token->type == REDIR_R
|| token->type == APPEND || token->type == HEREDOC_L)
return (true);
return (false);
}
int counter_string(struct s_tnode *tok)
{
int i;
i = 0;
while (tok)
{
if (tok->type == PIPE)
tok = tok->next;
else if (tok->type == REDIR_L || tok->type == REDIR_R
|| tok->type == APPEND || tok->type == HEREDOC_L)
tok = tok->next;
else if (tok->type == STRING)
i++;
tok = tok->next;
}
return (i);
}
void free_ex(t_job *job, t_cdata *c_data)
{
ft_free_tab(c_data->envp);
ft_free_tab(c_data->envp_export);
free_job_lst(job);
clear_history();
}