MiniDevil
As beautiful as a shell
Heredoc processing: reads lines and applies variable expansion. More...
#include <readline/readline.h>#include <stdio.h>#include "executor.h"#include "token.h"#include "env.h"#include "signals.h"#include "libft.h"#include "get_next_line.h"
Include dependency graph for heredoc.c:Heredoc processing: reads lines and applies variable expansion.
Definition in file heredoc.c.
Functions | |
| static void | write_heredoc_line (int fd, char *line, t_shell *shell, int expand) |
| Write one heredoc line (optionally expanding variables) More... | |
| static char * | read_heredoc_line (void) |
| Read a line from STDIN. More... | |
| static void | print_heredoc_eof_error (char *delim) |
| Print an EOF warning for an unterminated heredoc (bash style) More... | |
| static int | read_heredoc_lines (int fd, char *delim, t_shell *shell, int expand) |
| Read the lines until the delimiter or EOF/SIGINT. More... | |
| int | handle_heredoc (char *delimiter, int quoted, t_shell *shell) |
| Execute a heredoc (read input and return a readable fd) More... | |
|
static |
Write one heredoc line (optionally expanding variables)
| fd | Write end of the heredoc pipe |
| line | Line to write |
| shell | Shell context (for variable expansion) |
| expand | Whether to expand variables or not |
Definition at line 30 of file heredoc.c.
References t_shell::env, t_shell::exit_status, expand_variables(), and QUOTE_NONE.
Referenced by read_heredoc_lines().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Read a line from STDIN.
Reads lines interactively (readline) or from a pipe (get_next_line)
Definition at line 52 of file heredoc.c.
Referenced by read_heredoc_lines().
Here is the caller graph for this function:
|
static |
Print an EOF warning for an unterminated heredoc (bash style)
| delim | Delimiter that was expected for the heredoc |
Definition at line 73 of file heredoc.c.
Referenced by read_heredoc_lines().
Here is the caller graph for this function:
|
static |
Read the lines until the delimiter or EOF/SIGINT.
Each line is written to fd via write_heredoc_line()
| fd | Write end of the heredoc pipe |
| delim | Delimiter for the heredoc |
| shell | Shell context (for variable expansion) |
| expand | Whether to expand variables or not |
Definition at line 92 of file heredoc.c.
References g_signal, print_heredoc_eof_error(), read_heredoc_line(), and write_heredoc_line().
Referenced by handle_heredoc().
Here is the call graph for this function:
Here is the caller graph for this function:| int handle_heredoc | ( | char * | delimiter, |
| int | quoted, | ||
| t_shell * | shell | ||
| ) |
Execute a heredoc (read input and return a readable fd)
| delimiter | Heredoc delimiter |
| quoted | Whether the delimiter was quoted or not |
| shell | Shell context (for signals and variable expansion) |
Definition at line 133 of file heredoc.c.
References g_signal, read_heredoc_lines(), restore_stdin(), setup_heredoc_signals(), and setup_interactive_signals().
Referenced by collect_one().
Here is the call graph for this function:
Here is the caller graph for this function: