Executor prototypes for commands, pipes, redirections & heredocs.
int handle_heredoc(char *delimiter, int quoted, t_shell *shell)
Execute a heredoc (read input and return a readable fd)
int walk_heredocs(t_ast *node, t_shell *shell)
Recursively walk the AST collecting all heredocs.
static int collect_one(t_ast *node, t_shell *shell)
Collect a single heredoc content into a pipe fd.
static int walk_redir(t_ast *node, t_shell *shell)
Process a redirection node (and collecting heredoc if applicable)
int collect_heredocs(t_ast *node, t_shell *shell)
Pre collect all heredocs in the AST before the execution phase.
static void close_heredoc_fds(t_ast *node)
Recursively close cached heredoc file descriptors in the AST.
t_ast_data data
cmd, redir or binary data
t_node_type type
To determine which union member to pick.
struct s_ast * left
left child (before pipe)
struct s_ast * right
right child (after pipe)
int heredoc_fd
Heredoc pipe fd (-1 if not used)
char * file
Target filename or delimiter.
struct s_ast * cmd
Command subtree.
int quote
1 if delimiter was quoted