-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_freecommand.c
More file actions
32 lines (30 loc) · 1.28 KB
/
ft_freecommand.c
File metadata and controls
32 lines (30 loc) · 1.28 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_freecommand.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: makbulut <makbulut@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/30 23:55:59 by makbulut #+# #+# */
/* Updated: 2022/09/05 13:47:24 by makbulut ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
#include <unistd.h>
#include "minishell.h"
void ft_freecommand(t_command *cmd)
{
if (cmd)
{
if (cmd->out != 1)
close(cmd->out);
if (cmd->in != 0)
close(cmd->in);
ft_freearr_str(cmd->arguments);
ft_freearr_str(cmd->heredocsteps);
ft_freearr((void **)cmd->redirections, (void (*)(void *))ft_freestream);
ft_freearr_pipeline(cmd->subshells);
free(cmd->command);
free(cmd);
}
}