-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_parseredoutput.c
More file actions
34 lines (31 loc) · 1.37 KB
/
ft_parseredoutput.c
File metadata and controls
34 lines (31 loc) · 1.37 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_parseredoutput.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: makbulut <makbulut@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/10 16:39:09 by makbulut #+# #+# */
/* Updated: 2022/09/05 13:51:45 by makbulut ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
#include "42-Libft/libft.h"
int ft_parseredoutput(t_command *cmd, t_token **tokens, int *i)
{
t_stream *stream;
stream = ft_calloc(sizeof(t_stream), 1);
if (tokens[*i]->type == RED_APPEND)
stream->appendmode = 1;
(*i)++;
if (tokens[*i] && tokens[*i]->type == WORD)
{
stream->path = ft_strdup(tokens[*i]->data);
stream->type = STREAM_OUT;
ft_addarr_stream(&(cmd->redirections), stream);
return (1);
}
ft_syntaxerror(tokens[*i]);
ft_freestream(stream);
return (0);
}