diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-04 15:52:47 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-04 15:52:47 +0200 |
commit | 5cb3373a2e5a5109a5d3b72ef45978b98f885706 (patch) | |
tree | 11a0a6f467da3ddf227d2eaf6824c4509242025e /src/p_lcom.c | |
parent | ok nice (diff) | |
parent | $? fix (diff) | |
download | 42-minishell-5cb3373a2e5a5109a5d3b72ef45978b98f885706.tar.gz 42-minishell-5cb3373a2e5a5109a5d3b72ef45978b98f885706.tar.bz2 42-minishell-5cb3373a2e5a5109a5d3b72ef45978b98f885706.tar.xz 42-minishell-5cb3373a2e5a5109a5d3b72ef45978b98f885706.tar.zst 42-minishell-5cb3373a2e5a5109a5d3b72ef45978b98f885706.zip |
Merge branch 'master' into fix-pwd
Diffstat (limited to '')
-rw-r--r-- | src/p_lcom.c (renamed from src/ft_p_lcom.c) | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/src/ft_p_lcom.c b/src/p_lcom.c index a8449ae..2dbd505 100644 --- a/src/ft_p_lcom.c +++ b/src/p_lcom.c @@ -1,7 +1,7 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* ft_p_lcom.c :+: :+: :+: */ +/* p_lcom.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ @@ -17,14 +17,14 @@ #include <unistd.h> #include <errno.h> -#include "ft_d_define.h" -#include "ft_f_fail.h" -#include "ft_s_lcom.h" -#include "ft_s_lpipes.h" -#include "ft_s_struct.h" +#include "d_define.h" +#include "f_fail.h" +#include "s_lcom.h" +#include "s_lpipes.h" +#include "s_struct.h" static void - ft_rdr_err_check(char *ptr, + rdr_err_check(char *ptr, t_lcom **link) { if ((*link)->redir == -1 && ft_ischarset("><", *(ptr + 1))) @@ -42,7 +42,7 @@ static void } static int8_t - ft_get_rdrpath(char *ptr, + get_rdrpath(char *ptr, t_lcom **link) { char *p_rdrpath; @@ -68,7 +68,7 @@ static int8_t } static void - ft_get_rdrfd(const char *ptr, + get_rdrfd(const char *ptr, t_lcom **link) { while (ft_isdigit(*ptr)) @@ -85,7 +85,7 @@ static void } int8_t - ft_get_redir(const char word[], + get_redir(const char word[], t_lcom **link) { /* TODO: norme */ @@ -112,18 +112,18 @@ int8_t if ((*link)->redir > 0) { if (ft_isdigit(*(ptr - 1))) - ft_get_rdrfd(ptr - 1, link); + get_rdrfd(ptr - 1, link); else (*link)->rdrfd = STDOUT_FILENO; - ft_rdr_err_check(ptr, link); - if (ft_get_rdrpath(ptr, link) != 0) + rdr_err_check(ptr, link); + if (get_rdrpath(ptr, link) != 0) return (-1); } return (0); } int8_t - ft_p_lcom(const char line[], + p_lcom(const char line[], const uint64_t count, t_msh *msh) { @@ -139,18 +139,17 @@ int8_t while (i <= count && words[i]) { next = FALSE; - /* TODO: split pipes here */ if (ft_strchr(words[i], '|')) { - if (!(link = ft_lcom_new(NULL, msh))) + if (!(link = lcom_new(NULL, msh))) return (-1); - if (!(ft_split_pipes(words[i], link, msh))) + if (!(split_pipes(words[i], link, msh))) return (-1); next = TRUE; } - if (next == FALSE && !(link = ft_lcom_new(words[i], msh))) + if (next == FALSE && !(link = lcom_new(words[i], msh))) return (-1); - ft_lcom_add_back(&msh->curr, link); + lcom_add_back(&msh->curr, link); i++; } ft_delwords(words); |