Files
42_INT_07_minishell/srcs/parsing/expansions/rejoin_after_expand.c
2021-11-07 04:41:17 +01:00

40 lines
1.4 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rejoin_after_expand.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/07 02:01:33 by lperrey #+# #+# */
/* Updated: 2021/11/07 04:03:02 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
char *rejoin_after_expand(t_list *expand_lst)
{
t_list *head;
char *result;
head = expand_lst;
result = ft_calloc(1, 1);
if (!result)
{//todo wrap
perror("rejoin_after_expand() error");
return (ft_lstclear(&head, free));
}
while (expand_lst)
{
result = ft_strjoinfree_s1(result, expand_lst->content);
if (!result)
{//todo wrap
perror("rejoin_after_expand() error");
return (ft_lstclear(&head, free));
}
expand_lst = expand_lst->next;
}
ft_lstclear(&head, free);
return (result);
}