」 feat: Working split of pipe

This commit is contained in:
2024-05-18 17:44:12 +02:00
parent 03f39d20db
commit 825b7edf86

View File

@ -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);
} }