WIP parsing expansions
This commit is contained in:
39
srcs/parsing/expansions/rejoin_after_expand.c
Normal file
39
srcs/parsing/expansions/rejoin_after_expand.c
Normal file
@@ -0,0 +1,39 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 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);
|
||||
}
|
||||
Reference in New Issue
Block a user