How tgomez-f/minishell works
Minishell is an interactive Unix-shell implementation. Its main workflow reads a command line, tokenizes and expands it, builds commands, then dispatches builtins or external processes with redirections and pipelines; environment state and signals support that loop. The README documents these capabilities, while the excerpts show key calls in input, parsing, dispatch, and builtin handling. Several parsing and pipeline implementations are indexed but unsampled, so their documented roles are included without guessing their internal call paths.
Main entry points: main.c Main loop · executor.c Command dispatcher · exec_builtins.c Builtin commands · init_shell.c Shell and environment state
Components 19
Shell interaction
- Main loop
src/main/main.c - Input reader
src/main/get_input.c - Signal handlers
src/signals/touch_control.c
Command parsing
- Tokenizer
src/parsing/tokenize_line.c - Syntax validation
src/parsing/valid_syntax.c - Variable expansion
src/parsing/expander.c - Command construction
src/parsing/build_cmds_list.c - Here-doc input
src/parsing/create_heredoc.c
Execution runtime
- Command dispatcher
src/exec/executor.c - Builtin commands
src/builtins/exec_builtins.c - Environment builtins
src/builtins/export/builtins_fname_export.c - External commands
src/exec/find_cmd_path.c - Pipeline runner
src/exec/exec_pipe_line.c - Redirections
src/exec/redirections/redirections.c - Pipe wiring
src/exec/redirections/pipe_redirection.c
Shell state and utilities
- Shell and environment state
src/parsing/init_shell.c - Libft utilities
includes/LIBFT/src
Other components
- Shell user
- Processes and file descriptors
Connections 21
- Shell user → Input reader: enters commands
- Main loop → Input reader: reads input
src/main/main.c - Main loop → Signal handlers: initializes
src/main/main.c - Main loop → Tokenizer: tokenizes line
src/main/main.c - Tokenizer → Syntax validation: validates syntax
src/parsing/tokenize_line.c - Main loop → Variable expansion: expands tokens
src/main/main.c - Main loop → Command construction: builds commands
src/main/main.c - Command construction → Here-doc input: collects here-docs
- Main loop → Command dispatcher: dispatches commands
src/main/main.c - Command dispatcher → Builtin commands: runs builtins
src/exec/executor.c - Builtin commands → Environment builtins: handles export
src/builtins/exec_builtins.c - Command dispatcher → External commands: resolves command path
src/exec/executor.c - Command dispatcher → Pipeline runner: runs pipelines
src/exec/executor.c - Command dispatcher → Redirections: applies redirections
src/exec/executor.c - Pipeline runner → Pipe wiring: sets pipe descriptors
- Command dispatcher → Processes and file descriptors: forks and waits
src/exec/executor.c - External commands → Processes and file descriptors: executes command
- Redirections → Processes and file descriptors: changes file descriptors
- Main loop → Shell and environment state: initializes state
src/main/main.c - Variable expansion → Shell and environment state: uses environment
- Builtin commands → Shell and environment state: updates shell state