-
Notifications
You must be signed in to change notification settings - Fork 0
/
red_funcs.c
53 lines (48 loc) · 1.48 KB
/
red_funcs.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
49
50
51
52
53
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* red_funcs.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ebalgruu <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/27 01:40:01 by ebalgruu #+# #+# */
/* Updated: 2021/11/27 01:40:03 by ebalgruu ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
static t_red *ft_red_node_last(t_red *lst)
{
t_red *node;
node = NULL;
while (lst)
{
node = lst;
lst = lst->next;
}
return (node);
}
void ft_red_add_back(t_red **red, t_red *new)
{
if (*red)
ft_red_node_last(*red)->next = new;
else
*red = new;
}
void ft_redirect(char *str, int *i)
{
(*i)++;
if (str[*i] == '>' || str[*i] == '<')
(*i)++;
while (str[*i] == ' ')
(*i)++;
while (str[*i] && str[*i] != '|' && str[*i] != ' '
&& str[*i] != '<' && str[*i] != '>')
{
if (str[*i] == '\'')
ft_gap(str, i);
if (str[*i] == '\"')
ft_gap2(str, i);
else
(*i)++;
}
}