diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-27 21:15:32 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-27 21:15:32 +0200 |
commit | 237fd5e3595fa08ba41d826e5e7941d8aa114ba8 (patch) | |
tree | c492ff07e33222d1e285fedae94dde765e1ec585 | |
parent | In progress (diff) | |
download | 42-minishell-237fd5e3595fa08ba41d826e5e7941d8aa114ba8.tar.gz 42-minishell-237fd5e3595fa08ba41d826e5e7941d8aa114ba8.tar.bz2 42-minishell-237fd5e3595fa08ba41d826e5e7941d8aa114ba8.tar.xz 42-minishell-237fd5e3595fa08ba41d826e5e7941d8aa114ba8.tar.zst 42-minishell-237fd5e3595fa08ba41d826e5e7941d8aa114ba8.zip |
In progress
-rw-r--r-- | src/m_loop.c | 1 | ||||
-rw-r--r-- | src/p_redirs_heredoc.c | 9 |
2 files changed, 8 insertions, 2 deletions
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 <libft.h> +#include <unistd.h> #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); |