diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-07-27 18:55:07 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-07-27 18:55:07 +0200 |
commit | 487a66394061f2d14a2fa421302966b5442d643f (patch) | |
tree | 34237d4e9cb85f94bcefd46f399d2224dff3f6b3 /src/ft_s_lpipes.c | |
parent | Correct shell prompt (diff) | |
download | 42-minishell-487a66394061f2d14a2fa421302966b5442d643f.tar.gz 42-minishell-487a66394061f2d14a2fa421302966b5442d643f.tar.bz2 42-minishell-487a66394061f2d14a2fa421302966b5442d643f.tar.xz 42-minishell-487a66394061f2d14a2fa421302966b5442d643f.tar.zst 42-minishell-487a66394061f2d14a2fa421302966b5442d643f.zip |
I couldn't see shit
Diffstat (limited to 'src/ft_s_lpipes.c')
-rw-r--r-- | src/ft_s_lpipes.c | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/src/ft_s_lpipes.c b/src/ft_s_lpipes.c deleted file mode 100644 index 8bd34de..0000000 --- a/src/ft_s_lpipes.c +++ /dev/null @@ -1,105 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_s_lpipes.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */ -/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */ -/* */ -/* ************************************************************************** */ - -#include <libft.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ft_s_lcom.h" -#include "ft_s_lpipes.h" -#include "ft_s_struct.h" - -struct s_lpipes - *ft_lpipes_last(struct s_lpipes *lpipes) -{ - while (lpipes->next != NULL) - lpipes = lpipes->next; - return (lpipes); -} - -void - ft_lpipes_add_back(struct s_lpipes **alpipes, - struct s_lpipes *new) -{ - struct s_lpipes *tmp; - - if (!*alpipes) - *alpipes = new; - else - { - tmp = ft_lpipes_last(*alpipes); - tmp->next = new; - } -} - -void - ft_lpipes_clear(struct s_lpipes **lpipes) -{ - struct s_lpipes *tmp; - struct s_lpipes *renext; - - if (!lpipes) - return ; - tmp = *lpipes; - while (tmp) - { - renext = tmp->next; - ft_lcom_clear(&tmp->one); - ft_memdel((void*)&tmp); - tmp = renext; - } - *lpipes = NULL; -} - -struct s_lpipes - *ft_lpipes_new(const char pipedword[], - t_msh *msh) -{ - struct s_lpipes *link; - - if (!(link = (struct s_lpipes*)malloc(sizeof(struct s_lpipes)))) - return (NULL); - link->one = NULL; - if (!(link->one = ft_lcom_new(pipedword, msh))) - { - return (NULL); - } - link->next = NULL; - return (link); -} - -struct s_lpipes - *ft_split_pipes(const char word[], - t_lcom *lcom, - t_msh *msh) -{ - struct s_lpipes *lpipes; - char **words; - size_t i; - - if (!(words = ft_split(word, '|'))) - return (NULL); - i = 0; - if (!(lpipes = (struct s_lpipes*)malloc(sizeof(struct s_lpipes)))) - return (NULL); - while (words[i]) - { - if (!(lpipes = ft_lpipes_new(words[i], msh))) - { - return (NULL); - } - ft_lpipes_add_back(&lcom->pipes, lpipes); - i++; - } - ft_delwords(words); - return (lpipes); -} |