diff options
Diffstat (limited to 'src')
| -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); | 
