mirror of
https://github.com/KeyZox71/ft_minipowershell.git
synced 2025-03-15 11:26:51 +01:00
「✨」 feat: Working split of pipe
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/05/07 13:26:40 by adjoly #+# #+# */
|
/* Created: 2024/05/07 13:26:40 by adjoly #+# #+# */
|
||||||
/* Updated: 2024/05/08 14:38:33 by adjoly ### ########.fr */
|
/* Updated: 2024/05/18 17:12:42 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -15,17 +15,20 @@
|
|||||||
|
|
||||||
t_list *split_pipe(char *readline)
|
t_list *split_pipe(char *readline)
|
||||||
{
|
{
|
||||||
//char *tmp;
|
char **split;
|
||||||
char *av;
|
char **tmp;
|
||||||
//char *cmd_start;
|
|
||||||
t_list *list;
|
t_list *list;
|
||||||
|
|
||||||
|
split = ft_split(readline, '|');
|
||||||
|
tmp = split;
|
||||||
|
if (!*(split+1))
|
||||||
|
return (ft_lstnew((void *)readline));
|
||||||
list = NULL;
|
list = NULL;
|
||||||
if (!list)
|
while (tmp && *tmp)
|
||||||
{
|
{
|
||||||
av = ft_calloc(sizeof(readline), sizeof(char));
|
ft_lstadd_back(&list, ft_lstnew((void *)(*tmp)));
|
||||||
ft_strlcpy(av, readline, ft_strlen(readline));
|
tmp++;
|
||||||
ft_lstadd_back(&list, ft_lstnew((void*)split_cmd(av)));
|
|
||||||
}
|
}
|
||||||
|
free(split);
|
||||||
return (list);
|
return (list);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user