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 /src/p_redirs_heredoc.c | |
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
Diffstat (limited to '')
-rw-r--r-- | src/p_redirs_heredoc.c | 9 |
1 files changed, 8 insertions, 1 deletions
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); |