summaryrefslogtreecommitdiffstats
path: root/src/p_redirs_heredoc.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/p_redirs_heredoc.c9
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);