summaryrefslogtreecommitdiffstats
path: root/src/m_loop_counter.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/m_loop_counter.c')
-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,