How szymonsuchanek/42_minishell works
Project type and purpose
• This is a “minishell” command-line shell, implemented in C.
• It provides interactive command parsing, built-in commands (cd, echo, export, etc.), external command execution with fork/exec, pipes, redirection, environment-variable expansion, and its own simple garbage collector and utility library (lib_ft).
File structure
• Top-level:
• inc/ → headers for the shell (cmd.h, minishell.h)
• lib_ft/ → custom utility library (string, memory, list ops, error handling)
• src/ → all the shell’s modules, subdivided into:
– builtin/ → implementations of built-in shell commands
– env/ → environment‐variable list, expansion routines
– parsing/ → tokenization, here-doc, quote handling, validation
– execution/ → forks, pipes, file redirection, finding binaries
– garbage_colector/ → alloc/free tracking for safe memory management
– main.c, signals.c, validate_input.c
• Makefile, .vscode/, config files, and README.txt for build and project hooks.
README insights
• Minimal content: instructions for git hooks setup, mention of “signals in forks.”
Elements
• User → CLI
• CLI → Parser
• Parser ↔ Env Manager (variable lookup & expansion)
• Parser → Executor
• Executor → Built-in Handler OR Executor → fork/exec external
• Executor → Garbage Collector (register/release memory)
• Core modules (Parser, Executor) in another
• Support services (Env, GC, lib_ft) in a third
Final advice
• Be highly detailed: break execution flow into “fork process”, “set up pipe”, “dup2 redirection”, “execve call”.
• Every module boundary and external dependency (OS calls, lib_ft).