diff --git a/include/execution.h b/include/execution.h index be6273e..2a85fb8 100644 --- a/include/execution.h +++ b/include/execution.h @@ -6,7 +6,7 @@ /* By: mmoussou # include # include +# include +# include # include # include # include "libft.h" diff --git a/src/exec/heredoc.c b/src/exec/heredoc.c new file mode 100644 index 0000000..ece919a --- /dev/null +++ b/src/exec/heredoc.c @@ -0,0 +1,51 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* heredoc.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: mmoussou "); + while (ft_strcmp(line, delimiter)) + { + status = write(tmp_fd, line, ft_strlen(line)); + status = write(tmp_fd, "\n", 1); + free(line); + line = readline("heredoc> "); + } + status = write(tmp_fd, "\0", 1); + if (status == -1) + { + close(tmp_fd); + return (-1); + } + } + else + waitpid(fork_pid, NULL, 0); + return (tmp_fd); +}