-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecution_utils.c
More file actions
executable file
·52 lines (47 loc) · 1.45 KB
/
execution_utils.c
File metadata and controls
executable file
·52 lines (47 loc) · 1.45 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* execution_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yuhyoon <yuhyoon@student.42.gyeongsan> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/23 17:02:52 by yuhyoon #+# #+# */
/* Updated: 2025/03/25 01:09:38 by yuhyoon ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void free_splited(char **abs)
{
int i;
i = 0;
if (!abs)
return ;
while (abs[i] != NULL)
{
free(abs[i]);
abs[i] = NULL;
i++;
}
free(abs);
}
char **create_str_2(t_list **head)
{
t_list *tmp;
char *subsrc;
char **str;
int i;
int size;
size = ft_lstsize(*head);
str = malloc(sizeof(char *) * (size + 1));
i = 0;
tmp = *head;
while (i < size)
{
subsrc = ((t_compare *)tmp->content)->src_span;
str[i] = ft_strdup(subsrc);
i++;
tmp = tmp->next;
}
str[i] = NULL;
return (str);
}