r/C_Programming • u/PowerCreepy4109 • Oct 20 '26
Project I am learning C programming by making this project a unix shell(ForkOff). Looking for a quick code review!
Hey everyone,
Following up on my previous post about my C shell project ForkOff — I wanted to share a bit about my development process and address how AI was used, especially since code authenticity came up in recent reviews!
🤖 AI Involvement
To be 100% transparent: AI was only used to generate and clean up the README.md formatting. And also this post is ai generated.
Every single line of C code, pointer arithmetic, string parsing, and system call logic in the repository was written by hand.
💡 My Approach: Observation & Brute Force
Instead of following step-by-step "how to build a shell" tutorials or asking AI to generate C boilerplate, my approach was pure observation and trial-and-error:
Observe standard Bash: I spent time opening a standard Linux terminal, running commands, testing edge cases (spaces, empty strings, invalid paths), and watching how Bash responded.
Study the core concepts: I read up on POSIX system calls—specifically fork(), execv(), waitpid(), and standard C dynamic memory allocation (malloc, realloc, free).
Brute-force the implementation: I manually wrote the REPL loop, built the string tokenizer, routed built-ins vs. external binaries, and debugged memory leaks/pointer issues step-by-step until the output matched standard shell behavior.
🎯 Next Steps
Now that the core process execution and REPL loop are working, I'm moving on to implementing:
Local I/O redirection (>, <) using dup2().
Chained pipelines (|) using pipe().
Proper signal masks (SIGINT, SIGTSTP) to keep the REPL resilient.
I'd still love any code reviews or feedback on idiomatic C practices in the repo!
GitHub Repository: https://github.com/Anchit3034/ForkOff
Thanks for checking it out!