13 #include <readline/readline.h>
20 #include "get_next_line.h"
38 ft_putendl_fd(expanded, fd);
42 ft_putendl_fd(line, fd);
57 if (isatty(STDIN_FILENO))
58 return (readline(
"> "));
59 line = get_next_line(STDIN_FILENO);
62 len = ft_strlen(line);
63 if (len > 0 && line[len - 1] ==
'\n')
75 ft_putstr_fd(
"minishell: warning: here_document delimited by", 2);
76 ft_putstr_fd(
" end-of-file (wanted `", 2);
77 ft_putstr_fd(delim, 2);
78 ft_putstr_fd(
"')\n", 2);
109 if (!ft_strncmp(line, delim, -1))
140 if (pipe(pipe_fd) == -1)
141 return (perror(
"minishell: pipe"), -1);
Environment variable management prototypes.
Executor prototypes for commands, pipes, redirections & heredocs.
char * expand_variables(char *str, t_env *env_list, t_quote_type quote_type, int exit_status)
Expand all $VARIABLE in a string.
int handle_heredoc(char *delimiter, int quoted, t_shell *shell)
Execute a heredoc (read input and return a readable fd)
static void print_heredoc_eof_error(char *delim)
Print an EOF warning for an unterminated heredoc (bash style)
static char * read_heredoc_line(void)
Read a line from STDIN.
static void write_heredoc_line(int fd, char *line, t_shell *shell, int expand)
Write one heredoc line (optionally expanding variables)
static int read_heredoc_lines(int fd, char *delim, t_shell *shell, int expand)
Read the lines until the delimiter or EOF/SIGINT.
void restore_stdin(void)
Restore STDIN after heredoc SIGINT closed it.
void setup_heredoc_signals(void)
Configure signals for heredoc.
volatile sig_atomic_t g_signal
The single global variable.
void setup_interactive_signals(void)
Configure signals for the interactive prompt.
Signal handler prototypes.
t_env * env
Environment linked list.
int exit_status
Last command's exit status.
Lexer, tokenizer, expander, and quote handling prototypes.