How the-to/holbertonschool-simple_shell works
This is a small C UNIX shell. Its principal workflow reads interactive or piped input, tokenizes a command, handles the exit and env builtins, otherwise resolves an executable through PATH, then forks, executes it, waits, and reports its status. Environment lookup supports PATH resolution, while shared cleanup handles allocated memory. The graph follows relationships explicit in the README or sampled source; it does not infer unshown calls, such as a direct use of the cleanup helper on every runtime path.
Main entry points: main.c Shell loop · builtins.c Exit and env builtins · execute.c Process executor · wich.c Executable resolver
Components 11
Input and parsing
- Shell loop
main.c - Command tokenizer
split_string.c
Command handling
- Builtin dispatch
main.c - Exit and env builtins
builtins.c - Executable resolver
wich.c - Process executor
execute.c
Runtime support
- Environment lookup
_getenv.c - Memory cleanup
freeall.c - Shell declarations
main.h
Other components
- Shell user
- External command
Connections 14
- Shell user → Shell loop: provides input
README.md - Shell loop → Shell user: prints prompt
main.c - Shell loop → Command tokenizer: tokenizes input
main.c - Shell loop → Exit and env builtins: checks builtins
main.c - Shell loop → Process executor: executes command
main.c - Shell loop → Builtin dispatch: dispatches builtins
main.c - Builtin dispatch → Exit and env builtins: calls handlers
main.c - Process executor → Executable resolver: resolves command
execute.c - Executable resolver → Environment lookup: reads PATH
wich.c - Process executor → External command: forks and execs
execute.c - Exit and env builtins → Shell user: prints environment
builtins.c - Exit and env builtins → Shell loop: exits shell
builtins.c - Exit and env builtins → Memory cleanup: frees memory
builtins.c - Process executor → Memory cleanup: frees on failure
execute.c