24 lines
318 B
C
24 lines
318 B
C
|
#include "minishell.h"
|
||
|
|
||
|
int ft_heredoc(char *stop)
|
||
|
{
|
||
|
int fds[2];
|
||
|
char *line;
|
||
|
|
||
|
pipe(fds);
|
||
|
line = readline("> ");
|
||
|
while (line != NULL)
|
||
|
{
|
||
|
if (ft_strcmp(line, stop) == 0)
|
||
|
{
|
||
|
free(line);
|
||
|
break ;
|
||
|
}
|
||
|
ft_putstr_fd(line, fds[1]);
|
||
|
free(line);
|
||
|
line = readline("> ");
|
||
|
}
|
||
|
close(fds[1]);
|
||
|
return (fds[0]);
|
||
|
}
|