/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* heredoc.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: cchauvet "); line = get_next_line(*ft_get_heredoc()); if (line == NULL && *ft_get_heredoc() == -1) { ft_closer(fds); return (1); } return (0); } int ft_heredoc(t_data *data, char *stop) { char *line; int fds[2]; int return_code; if (pipe(fds) == -1) return (-1); *ft_get_heredoc() = dup(0); ft_printf("> "); line = get_next_line(*ft_get_heredoc()); while (line != NULL) { return_code = ft_heredoc2(data, stop, line, fds); if (return_code == 2) break ; else if (return_code) return (-2); } close(fds[1]); *ft_get_heredoc() = -1; return (fds[0]); }