-
Notifications
You must be signed in to change notification settings - Fork 1
/
expander.c
39 lines (36 loc) · 1.4 KB
/
expander.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* expander.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: omoussao <omoussao@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/17 13:35:44 by omoussao #+# #+# */
/* Updated: 2022/03/05 17:02:58 by omoussao ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
t_list *expander(t_list *tokens)
{
t_node *top;
t_node *next;
tokens = delete_quotes(tokens);
tokens = make_groups(tokens);
tokens = concat_words(tokens);
next = NULL;
top = tokens->top;
while (top && top->token != ENDOFCMD)
{
next = top->next;
if (top->token & REDIRECT)
next = handle_redirects(top);
else if (top->token & TILDE)
next = expand_tilde(top);
else if (top->token & WILDC)
next = expand_wildcards(tokens, top);
else
next = top->next;
top = next;
}
return (tokens);
}