summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsalad <fmoenne-@student.le-101.fr>2020-11-02 21:01:10 +0100
committersalad <fmoenne-@student.le-101.fr>2020-11-02 21:01:10 +0100
commit6bc3b1f99e7c8b5a5d58f20526543d860c7fdef0 (patch)
treed4e0e895cedb50a98dcb0428d9a07cb85c9bb768
parentmerge happenned (diff)
download42-minishell-6bc3b1f99e7c8b5a5d58f20526543d860c7fdef0.tar.gz
42-minishell-6bc3b1f99e7c8b5a5d58f20526543d860c7fdef0.tar.bz2
42-minishell-6bc3b1f99e7c8b5a5d58f20526543d860c7fdef0.tar.xz
42-minishell-6bc3b1f99e7c8b5a5d58f20526543d860c7fdef0.tar.zst
42-minishell-6bc3b1f99e7c8b5a5d58f20526543d860c7fdef0.zip
merge happenned
-rw-r--r--src/m_loop_counter.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/m_loop_counter.c b/src/m_loop_counter.c
index 430968a..d1d4dcf 100644
--- a/src/m_loop_counter.c
+++ b/src/m_loop_counter.c
@@ -24,7 +24,10 @@ char *m_counter_line_backslash(int fd,
{
char *counter_line;
- c_gnl(fd, &counter_line, psx, msh);
+ if (fd == STDIN_FILENO)
+ c_gnl(fd, &counter_line, psx, msh);
+ else
+ get_next_line(fd, &counter_line);
if (counter_line[0] != C_NUL)
{
l = ft_nrealloc(l,
@@ -42,7 +45,10 @@ char *m_counter_line_pipes(int fd, unsigned char psx, char *line, t_msh *msh)
{
char *counter_line;
- c_gnl(fd, &counter_line, psx, msh);
+ if (fd == STDIN_FILENO)
+ c_gnl(fd, &counter_line, psx, msh);
+ else
+ get_next_line(fd, &counter_line);
if (counter_line[0] != C_NUL)
{
line = ft_nrealloc(line,
@@ -63,7 +69,10 @@ char *m_counter_line_quotes(int fd,
{
char *counter_line;
- c_gnl(fd, &counter_line, psx, msh);
+ if (fd == STDIN_FILENO)
+ c_gnl(fd, &counter_line, psx, msh);
+ else
+ get_next_line(fd, &counter_line);
if (counter_line[0] != C_NUL)
{
line = ft_nrealloc(line,