How myivanov-c/minishell works
Minishell is an interactive C shell. Its main workflow reads a command line, tokenizes and validates it, builds a command tree, then expands and executes commands with redirections, pipes, and built-ins. The graph also preserves documented shell capabilities such as heredocs, logical operators, environment handling, and signals. Some subsystem links rely on the README because their implementation files were not sampled; those relationships are cited to the README rather than presented as inspected source behavior.
Main entry points: exec_cmdtree.c Tree dispatcher · tokenize.c Tokenize input · expand.c Expansion · minishell.c Interactive input
Components 21
Input and parsing
- Interactive input
minishell.c - Tokenize input
get_cmdtree/tokenize.c - Syntax checks
get_cmdtree/check_syntax - Command tree
get_cmdtree/create_cmdtree/create_cmdtree.c - Heredoc collection
get_cmdtree/here_doc.c - Quote-aware tokens
token_utils
Execution
- Tree dispatcher
exec_cmdtree/exec_cmdtree.c - Expansion
exec_cmdtree/expand/expand.c - Variable expansion
exec_cmdtree/expand/get_expanded_env.c - Wildcard matching
exec_cmdtree/expand/Wildcards - Redirections
exec_cmdtree/redirect.c - Pipe execution
exec_cmdtree/exec_pipe.c - Logical and groups
exec_cmdtree/exec_control.c - Command execution
exec_cmdtree/exec_cmd.c
Shell state and built-ins
- Built-in dispatch
exec_cmdtree/builtins/builtin.c - Built-in commands
exec_cmdtree/builtins - Environment state
minishell.c - Signal handling
minishell.c
Runtime support
- Utility library
libft/libft.h
Other components
- Shell user
- External commands
Connections 21
- Shell user → Interactive input: enters commands
- Interactive input → Tokenize input: submits line
- Tokenize input → Syntax checks: checks tokens
- Syntax checks → Command tree: accepts valid input
- Tokenize input → Command tree: builds command tree
- Command tree → Heredoc collection: collects heredocs
- Tokenize input → Quote-aware tokens: tracks quote flags
- Tree dispatcher → Expansion: expands commands
- Expansion → Variable expansion: expands variables
- Expansion → Wildcard matching: matches patterns
- Tree dispatcher → Redirections: applies redirections
- Tree dispatcher → Pipe execution: dispatches pipes
- Tree dispatcher → Logical and groups: dispatches operators
- Tree dispatcher → Command execution: executes leaves
- Command execution → Built-in dispatch: checks built-ins
- Command execution → External commands: runs external commands
- Built-in dispatch → Built-in commands: dispatches built-ins
- Built-in commands → Environment state: manages variables
- Interactive input → Signal handling: handles interrupts
minishell.c - Expansion → Environment state: reads variables
- Tokenize input → Utility library: uses utilities