26 lines
369 B
C
26 lines
369 B
C
#include "minishell.h"
|
|
#include <readline/history.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]);
|
|
add_history(line);
|
|
free(line);
|
|
line = readline("> ");
|
|
}
|
|
close(fds[1]);
|
|
return (fds[0]);
|
|
}
|