-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils_pipex.c
40 lines (36 loc) · 1.28 KB
/
utils_pipex.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils_pipex.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rdanyell <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/15 17:18:58 by rdanyell #+# #+# */
/* Updated: 2022/06/16 13:42:00 by rdanyell ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void std_out_close(int save_stdout)
{
close(0);
dup2(save_stdout, 0);
close(save_stdout);
}
void pipe_close(t_com *com, int fd0, int fd1)
{
if (com->next)
{
dup2(fd0, 0);
close(fd0);
close(fd1);
}
}
void free_pipe_struct(t_exec *exec)
{
if (exec->path_cmd)
free_array(exec->path_cmd);
if (exec->cmd_full)
free_array(exec->cmd_full);
if (exec->env)
free_array(exec->env);
}