From 56ccad6b85a5f3f17eebaf4ba511e07ba760b050 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sat, 15 Aug 2020 18:00:23 +0200 Subject: Can read scripts, but need to handle fails --- src/m_loop.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/m_loop.c') diff --git a/src/m_loop.c b/src/m_loop.c index 140d009..84efddf 100644 --- a/src/m_loop.c +++ b/src/m_loop.c @@ -82,7 +82,7 @@ void } uint8_t - m_loop(t_msh *msh) + m_loop(int32_t fd, t_msh *msh) { char *line; char *quote; @@ -91,8 +91,9 @@ uint8_t gnl = 1; while (gnl > 0) { - m_prompt(msh); - gnl = get_next_line(STDIN_FILENO, &line); + if (fd == STDIN_FILENO) + m_prompt(msh); + gnl = get_next_line(fd, &line); if (line[0] != '\0') { if (!(quote = ft_strchr(line, '\'')) && !(quote = ft_strchr(line, '\"'))) -- cgit v1.2.3