-
Notifications
You must be signed in to change notification settings - Fork 0
/
parse_redirection.c
39 lines (34 loc) · 1.42 KB
/
parse_redirection.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parse_redirection.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: akhalid <akhalid@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/08 01:58:05 by akhalid #+# #+# */
/* Updated: 2022/03/01 16:57:43 by akhalid ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
t_redirect *init_redirection(char *val, t_type type)
{
t_redirect *red;
red = (t_redirect *)malloc(sizeof(t_redirect));
red->file = ft_strdup(val);
red->type = type;
red->next = NULL;
return (red);
}
void create_redirection(t_redirect *red, char *val, t_type type)
{
t_redirect *new;
t_redirect *current;
current = red;
while (current && current->next)
current = current->next;
new = (t_redirect *)malloc(sizeof(t_redirect));
new->file = ft_strdup(val);
new->type = type;
new->next = NULL;
current->next = new;
}