How msgenan/42cursus-minishell works
Minishell is an interactive C shell. Its principal workflow reads a command line, tokenizes and validates it, builds command and redirection structures, expands arguments, then dispatches built-ins or launches external processes with pipes and redirections. The README also documents prompt history, signals, environment management, and heredocs. The graph preserves these documented capabilities; detailed wiring is limited to sampled source, so unsampled subsystem links are omitted where ownership is unclear.
Main entry points: main.c Interactive loop · executor.c Executor · builtins Built-in commands · func_tools.c Command lookup
Components 21
Shell interaction
- Interactive loop
src/main.c - Command history
src/main.c - Signal handling
src/utils/signal.c
Command processing
- Lexer
src/lexer/lexer.c - Syntax validation
src/utils/syntax.c - Command parser
src/parser/parser.c - Expansion
src/parser/expand/expand.c
Command execution
- Executor
src/executor/executor.c - Builtin dispatch
src/executor/builtins.c - Built-in commands
src/builtins - Redirections
src/executor/redirections/redir_funcs.c - Here-documents
src/executor/heredoc.c - Command lookup
src/utils/tools/func_tools.c - Processes and pipes
src/executor/executor.c
Shell state
- Environment state
src/executor/environment.c - Environment tools
src/utils/tools/env_tools.c - Export tools
src/utils/tools/export_tools.c
Other components
- Shell user
- Terminal and history service
- Operating system
- Filesystem
Connections 25
- Shell user → Interactive loop: enters commands
- Interactive loop → Terminal and history service: reads prompt
- Interactive loop → Command history: records input
- Command history → Terminal and history service: updates history
- Interactive loop → Signal handling: initializes handlers
- Interactive loop → Lexer: tokenizes input
- Interactive loop → Syntax validation: validates tokens
- Interactive loop → Command parser: parses tokens
- Interactive loop → Expansion: expands commands
- Expansion → Environment state: reads variables
- Interactive loop → Executor: executes commands
- Executor → Builtin dispatch: dispatches built-ins
- Builtin dispatch → Built-in commands: invokes command
- Built-in commands → Environment state: updates environment
- Built-in commands → Environment tools: uses environment tools
- Built-in commands → Export tools: uses export tools
- Executor → Here-documents: handles heredocs
- Executor → Redirections: applies redirections
- Executor → Processes and pipes: launches pipeline
- Processes and pipes → Operating system: forks and executes
- Executor → Command lookup: resolves command
- Command lookup → Environment state: reads PATH
- Command lookup → Filesystem: searches executable
- Redirections → Filesystem: opens files
- Processes and pipes → Filesystem: redirects descriptors