How sel-l/minishell2 works
Minishell’s main workflow is an interactive prompt that reads a command, parses it into executable structure, and runs built-ins or external programs; it also supports environment expansion, pipes, redirections, heredocs, and signal handling. Sampled source confirms the main loop, environment initialization, AST execution, pipe dispatch, expansion, and heredoc preparation. Several parsing and execution details are represented from the README and file tree; links without direct excerpt evidence are marked dashed with null evidence.
Main entry points: execution.c Execution dispatcher · main.c Shell loop · ft_readline.c Prompt input · parsing.c Parse and validate
Components 18
Input and parsing
- Shell loop
src/main.c - Prompt input
src/parsing/ft_readline.c - Parse and validate
src/parsing/parsing.c - Tokenize commands
src/tokenizer/tokenizer.c - Command AST
src/ast/ast_parse_cmd.c
Shell state
- Variable expansion
src/expansion/expansion.c - Environment state
src/env/env_op.c - Signal handling
src/signals/signals.c
Command runtime
- Execution dispatcher
src/execution/execution.c - Pipeline processes
src/execution/execution.c - Apply redirections
src/execution/apply_redir.c - Heredoc input
src/heredoc/heredoc.c - Built-in commands
src/builtins/builtin.c - External programs
src/execution/get_path.c
Runtime support
- Shell interfaces
headers/main_minishell.h - C utility library
libft/libft.h - Line reader utility
libft/gnl/get_next_line.c
Other components
- Shell user
Connections 18
- Shell user → Shell loop: starts shell
- Shell loop → Prompt input: reads prompt
src/main.c - Prompt input → Parse and validate: submits command
- Parse and validate → Tokenize commands: tokenizes input
- Tokenize commands → Command AST: builds command tree
- Command AST → Variable expansion: expands words
- Variable expansion → Environment state: reads variables
src/expansion/expansion.c - Shell loop → Environment state: initializes environment
src/main.c - Shell loop → Execution dispatcher: executes AST
src/main.c - Shell loop → Signal handling: sets signal modes
src/main.c - Execution dispatcher → Pipeline processes: dispatches pipes
src/execution/execution.c - Execution dispatcher → Built-in commands: dispatches built-ins
- Execution dispatcher → External programs: runs programs
- Execution dispatcher → Apply redirections: applies redirections
- Execution dispatcher → Heredoc input: prepares heredocs
src/execution/execution.c - Shell user → Pipeline processes: requests pipelines
- Shell user → Apply redirections: requests redirection
- Shell user → Heredoc input: provides delimiter input