From 237fd5e3595fa08ba41d826e5e7941d8aa114ba8 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sun, 27 Sep 2020 21:15:32 +0200 Subject: In progress --- src/m_loop.c | 1 - src/p_redirs_heredoc.c | 9 ++++++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/m_loop.c b/src/m_loop.c index 8f3d8d3..8912284 100644 --- a/src/m_loop.c +++ b/src/m_loop.c @@ -145,7 +145,6 @@ uint8_t if (fd == STDIN_FILENO) m_handle_hist(hist, line, msh); m_parse_and_run_line(line, msh); - /* TODO: (null): Bad address on "msh ~> echo a > asd; cat < asd" but not on "msh ~> echo a > asd; cat asd" */ } else ft_memdel((void*)&line); diff --git a/src/p_redirs_heredoc.c b/src/p_redirs_heredoc.c index 03d044b..7c2ef90 100644 --- a/src/p_redirs_heredoc.c +++ b/src/p_redirs_heredoc.c @@ -11,8 +11,10 @@ /* ************************************************************************** */ #include +#include #include "d_define.h" +#include "m_prompt.h" #include "s_struct.h" char @@ -22,13 +24,18 @@ char char *line; int8_t gnl; + line = NULL; heredoc = NULL; gnl = 1; if ((heredoc = ft_strdup("")) == NULL) return (NULL); - while (gnl > 0 && ft_strncmp(path, line, ft_strlen(path) + 1) != 0) + while (gnl > 0) { + if (msh->fd == STDIN_FILENO) + m_prompt_psx(2, msh); gnl = get_next_line(msh->fd, &line); + if (ft_strncmp(path, line, ft_strlen(path) + 1) != 0) + return (heredoc); if ((heredoc = ft_nrealloc(heredoc, ft_strlen(heredoc), ft_strlen(heredoc) + ft_strlen(line) + 2)) == NULL) return (heredoc); -- cgit v1.2.3