-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsplit_cmds.c
41 lines (36 loc) · 1.24 KB
/
split_cmds.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* split_cmds.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zhabri <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/13 13:53:15 by zhabri #+# #+# */
/* Updated: 2022/12/15 11:44:23 by zhabri ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
static void trim_tab(char **tab)
{
int i;
i = 0;
while (tab[i])
{
tab[i] = remove_quotes(ft_strtrimf(tab[i], " \t"));
i++;
}
}
void split_cmds(void)
{
t_list *cmd;
if (g_glob->cmds)
{
cmd = *g_glob->cmds;
while (cmd)
{
cmd->content = ft_split_quotes(cmd->content, " \t");
trim_tab(cmd->content);
cmd = cmd->next;
}
}
}