minishell
Minishell Project for École 42
|
Subfunctions of process_in_heredoc() for handling here-documents and input redirection. More...
#include "minishell.h"
Functions | |
bool | get_input (int fd, char *delimiter) |
Reads input for a here-document until a specified delimiter. | |
int | create_heredoc (char *delimiter) |
Creates a here-document file and gathers input. | |
bool | open_inputfile (t_executor *current, t_lexer_list *lexer) |
Handles opening an input file. | |
Subfunctions of process_in_heredoc() for handling here-documents and input redirection.
int create_heredoc | ( | char * | delimiter | ) |
Creates a here-document file and gathers input.
Creates a temporary file for a here-document, gathers input for it by calling get_input(). Returns a file descriptor to the created file.
delimiter | The delimiter that signals the end of the here-document. |
bool get_input | ( | int | fd, |
char * | delimiter | ||
) |
Reads input for a here-document until a specified delimiter.
Reads input from the user, displaying a prompt, until the specified delimiter is entered. The input is written to the given file descriptor. Also handles ctrl-d (end-of-file from readline).
fd | The file descriptor to write the input to. |
delimiter | The delimiter that signals the end of the here-document. |
bool open_inputfile | ( | t_executor * | current, |
t_lexer_list * | lexer | ||
) |
Handles opening an input file.
Handles opening an input file for the given t_executor node, based on the given lexer list token type. It supports input redirection and here-document.
current | A pointer to the current t_executor node. |
lexer | A pointer to the current t_lexer_list node. |