MiniDevil
As beautiful as a shell
Shell entry point. More...
#include <readline/readline.h>#include <readline/history.h>#include "libft.h"#include "get_next_line.h"#include "signals.h"#include "token.h"#include "parser.h"#include "ast.h"#include "executor.h"#include "env.h"#include "minishell_ui.h"
Include dependency graph for main.c:Shell entry point.
Definition in file main.c.
Functions | |
| static int | process_input (char *input, t_shell *shell) |
| tokenize -> expand -> parse -> execute More... | |
| static char * | read_input (t_shell *shell) |
| Read 1 line of input from the user. More... | |
| static void | handle_input (char *input, t_shell *shell) |
| Filter and dispatch input to processing. More... | |
| static void | main_loop (t_shell *shell) |
| Main REPL (standard mode) More... | |
| int | main (int ac, char **av, char **envp) |
| Entry point. More... | |
|
static |
tokenize -> expand -> parse -> execute
On any stage failure, cleans up and returns an error status
| input | Raw input string |
| shell | Shell context |
Definition at line 35 of file main.c.
References collect_heredocs(), t_shell::current_ast, executor(), expand_all_tokens(), free_ast(), free_token_list(), parse(), and tokenize().
Referenced by handle_input().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Read 1 line of input from the user.
Uses readline with a prompt in interactive mode and get_next_line() otherwise (strips the trailing \n)
| shell | Shell context |
Definition at line 72 of file main.c.
References t_shell::interactive.
Referenced by main_loop().
Here is the caller graph for this function:
|
static |
Filter and dispatch input to processing.
| input | Raw input string |
| shell | Shell context |
Definition at line 98 of file main.c.
References t_shell::exit_status, t_shell::interactive, and process_input().
Referenced by main_loop().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Main REPL (standard mode)
setup signals -> read input -> handle SIGINT -> process
| shell | Shell context (the running flag controls the loop) |
Definition at line 123 of file main.c.
References t_shell::current_input, t_shell::exit_status, g_signal, handle_input(), t_shell::interactive, read_input(), t_shell::running, setup_execution_signals(), and setup_interactive_signals().
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| int main | ( | int | ac, |
| char ** | av, | ||
| char ** | envp | ||
| ) |
Entry point.
Initializes the shell state and eithers enters UI mode (–ui flag) or the standard REPL.
| ac | Argument count |
| av | Argument vector (–ui triggers UI mode) |
| envp | Environment passed by the OS |
Definition at line 163 of file main.c.
References t_shell::env, t_shell::exit_status, free_env_list(), init_env(), t_shell::interactive, t_shell::is_child, main_loop(), run_ui_mode(), t_shell::ui, and t_shell::ui_mode.
Here is the call graph for this function: