How polslag/minishell works
Minishell is an interactive C shell: it reads a command line, turns it into commands, then executes shell built-ins or external commands. Its documented capabilities include pipes, redirections, heredocs, environment expansion and environment-management built-ins. The excerpts show the prompt loop, token validation, command parsing and expansion calls; several execution and integration links are not sampled, so those are marked unverified rather than inferred as definite calls.
Main entry points: shell.c Interactive loop · parser.c Command parser · exec.c Command execution · env_setup.c Environment state
Components 19
Input and parsing
- Interactive loop
src/shell.c - Lexer
src/token.c - Syntax checks
src/syntax.c - Command parser
src/parser.c - Parse helpers
src/parser_utils.c - Command lists
src/command.c - Word expansion
src/expand.c - Heredoc input
src/heredoc.c - Heredoc expansion
src/heredoc_expand.c
Shell runtime
- Command execution
src/exec.c - Execution dispatch
src/exec_run.c - Redirections
src/redir.c - Executable lookup
src/utils_path.c
Environment and built-ins
- Environment state
src/env_setup.c - Environment helpers
src/env_utils.c - Shell built-ins
src/builtins
Shared utilities
- C utility library
lib/libft-pilagach/libft.h - Shell data types
include/minishell.h
Other components
- Shell user
Connections 21
- Shell user → Interactive loop: enters commands
- Interactive loop → Lexer: tokenizes input
src/shell.c - Interactive loop → Syntax checks: checks tokens
src/shell.c - Interactive loop → Command lists: parses commands
src/shell.c - Command lists → Command parser: calls parser
src/command.c - Command parser → Parse helpers: adds words
src/parser.c - Command parser → Word expansion: expands words
src/parser.c - Command parser → Redirections: creates redirections
src/parser.c - Interactive loop → Command execution: executes commands
src/shell.c - Command execution → Execution dispatch: dispatches execution
- Command execution → Redirections: applies redirections
- Command execution → Executable lookup: resolves executables
- Command execution → Shell built-ins: dispatches built-ins
- Word expansion → Environment state: looks up variables
- Heredoc input → Heredoc expansion: expands input
- Interactive loop → Environment state: initializes state
- Shell built-ins → Environment state: updates environment
- Command parser → Heredoc input: supports heredocs
- Interactive loop → Shell data types: uses shared types
src/shell.c - Command parser → Shell data types: uses shared types
src/parser.c - Parse helpers → C utility library: uses string helpers
src/parser_utils.c