diff options
Diffstat (limited to '')
-rw-r--r-- | src/ft_m_loop.c | 5 | ||||
-rw-r--r-- | src/ft_p_lcom.c | 28 | ||||
-rw-r--r-- | src/ft_p_lcom.h | 2 | ||||
-rw-r--r-- | src/ft_s_lcom.c | 3 |
4 files changed, 35 insertions, 3 deletions
diff --git a/src/ft_m_loop.c b/src/ft_m_loop.c index a96eea2..08bc0e4 100644 --- a/src/ft_m_loop.c +++ b/src/ft_m_loop.c @@ -37,9 +37,10 @@ uint8_t ft_memdel((void*)&line); ft_e_lcom(msh); ft_lcom_clear(&msh->curr); - /* TODO: GNL leak on "msh ~> exit" */ - /* TODO: redirect vvv redirect */ + /* TODO: GNL leak on "msh ~> exit" */ + /* TODO: redirect vvv redirect */ /* "msh ~> echo qwe >/dev/null; echo *.vscode >> .gitignore" */ + /* TODO: "msh ~> some command \": re GNL into ft_nrealloc */ } else { diff --git a/src/ft_p_lcom.c b/src/ft_p_lcom.c index 15247a2..ec30f43 100644 --- a/src/ft_p_lcom.c +++ b/src/ft_p_lcom.c @@ -15,6 +15,34 @@ #include "ft_s_lcom.h" #include "ft_s_struct.h" +void + ft_check_redir_file() +{ +} + +void + ft_get_redir(const char word[], + t_lcom **link) +{ + char *ptr; + + ptr = word; + while (*ptr) + { + if (*ptr == '<') + { + *link->redir = -1; + break ; + } + if (*ptr == '>') + { + *link->redir = (*(ptr + 1) == '>') ? (2) : (1); + break ; + } + ptr++; + } +} + int8_t ft_p_lcom(const char line[], const uint64_t count, diff --git a/src/ft_p_lcom.h b/src/ft_p_lcom.h index 556045b..4cbce6a 100644 --- a/src/ft_p_lcom.h +++ b/src/ft_p_lcom.h @@ -16,6 +16,8 @@ #include <stdint.h> #include "ft_s_struct.h" +void ft_get_redir(const char word[], + t_lcom **link); int8_t ft_p_lcom(const char line[], const uint64_t count, t_msh *msh); diff --git a/src/ft_s_lcom.c b/src/ft_s_lcom.c index 7a72378..6661b1e 100644 --- a/src/ft_s_lcom.c +++ b/src/ft_s_lcom.c @@ -105,9 +105,10 @@ t_lcom link->com = NULL; link->args = NULL; link->rdrpath = NULL; + /* TODO: redirections here */ + ft_get_redir(&link); if (!(words = ft_split(word, ' '))) return (NULL); - /* TODO: redirections here */ if (ft_fill_lcom(words, &link) < 0) { ft_delwords(words); |