summaryrefslogtreecommitdiffstats
path: root/src/m_loop.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-08-15 18:00:23 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-08-15 18:00:23 +0200
commit56ccad6b85a5f3f17eebaf4ba511e07ba760b050 (patch)
treeb7073ccf7712baf52ee5c7792130029495249d3f /src/m_loop.c
parentNow deletes comments (diff)
download42-minishell-56ccad6b85a5f3f17eebaf4ba511e07ba760b050.tar.gz
42-minishell-56ccad6b85a5f3f17eebaf4ba511e07ba760b050.tar.bz2
42-minishell-56ccad6b85a5f3f17eebaf4ba511e07ba760b050.tar.xz
42-minishell-56ccad6b85a5f3f17eebaf4ba511e07ba760b050.tar.zst
42-minishell-56ccad6b85a5f3f17eebaf4ba511e07ba760b050.zip
Can read scripts, but need to handle fails
Diffstat (limited to '')
-rw-r--r--src/m_loop.c7
1 files changed, 4 insertions, 3 deletions
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, '\"')))