How rvnsenkuuu/minishell works
Minishell is an interactive Unix command shell. Its principal workflow reads a line, transforms and lexes it into command/control structures, then executes commands and updates the shell’s exit status. Execution covers pipelines, logical operations, subshells, redirections, here-documents and built-ins; environment expansion, wildcard handling and signal behavior are separate runtime concerns. The README is empty, and sampled execution-preparation code is incomplete, so uncertain wiring—especially expansion and wildcard invocation—is omitted.
Main entry points: main.c Shell loop · lexer.c Lexer · ft_exec_class.c Execution dispatcher · ft_exec_cmd.c Command execution
Components 24
Shell lifecycle
- Shell loop
src/main.c
Input parsing
- Line transform
src/utils/ft_cmd_parsing.c - Lexer
src/lexer/lexer.c - Command construction
src/lexer/create_cmd.c - Control structures
src/lexer/create_logic.c - Pipe parsing
src/lexer/create_pipe.c - Subshell parsing
src/lexer/create_subshell.c
Execution
- Execution dispatcher
src/exec/ft_exec_class.c - Command execution
src/exec/ft_exec_cmd.c - Logical execution
src/exec/ft_exec_logic.c - Pipeline execution
src/exec/ft_exec_pipe.c - Subshell execution
src/exec/ft_exec_sub.c - Command preparation
src/exec/ft_cmd_init.c - Redirection
src/exec/ft_redir_child.c - Here-documents
src/exec/ft_handle_heredoc.c - Built-in commands
src/builtins/builtins_exec.c
Shell state
- Environment
src/env/create_env.c - Variable expansion
src/env/expand.c - Exit status
src/exitcodes/ft_exit_codes.c
Runtime support
- Signal handling
src/signal/signal.c - Wildcard matching
src/wildcard/wildcard.c
Other components
- Interactive user
- External programs
- Filesystem
Connections 25
- Interactive user → Shell loop: enters commands
- Shell loop → Environment: initializes
- Shell loop → Signal handling: sets handlers
- Shell loop → Line transform: transforms input
- Line transform → Lexer: returns line
- Shell loop → Lexer: lexes line
- Lexer → Command construction: builds commands
- Lexer → Control structures: builds logic
- Lexer → Pipe parsing: builds pipelines
- Lexer → Subshell parsing: builds subshells
- Command construction → Here-documents: creates here-doc
- Shell loop → Execution dispatcher: dispatches execution
- Execution dispatcher → Command execution: runs commands
- Execution dispatcher → Logical execution: runs logic
- Execution dispatcher → Pipeline execution: runs pipelines
- Execution dispatcher → Subshell execution: runs subshells
- Command execution → Command preparation: prepares command
- Command execution → Built-in commands: dispatches built-in
- Command execution → External programs: forks and executes
- Command execution → Redirection: sets child redirections
- Built-in commands → Environment: reads and updates
- Shell loop → Exit status: updates status
- Variable expansion → Environment: reads variables
- Wildcard matching → Filesystem: reads directory entries
- Redirection → Filesystem: opens files