A simple shell for learning purposes.
This project can only be compiled on a Linux environment, as it uses Linux syscalls directly without preprocessor conditions to determine platform-specific code.
Ensure you have the following dependencies installed:
To compile the code, use the following commands:
$ make # to build
$ make run # to build and run
To remove generated files, use:
$ make clean # to remove the `.o`, `.d`, and binary files
$ make clean_all # to remove these files from both the main application and the tests
src/
: Contains the source code.obj/
: Created during compilation, contains compiled objects and dependencies.tests/
: Contains the project's test files, with a similar structure to the main source code.compile_flags.txt
: Specifies include paths for the project to help the LSP in recognizing those paths, acting as a simpler version ofcompile_commands.json
and the.clangd
config file.
This project uses the GoogleTest framework for testing. Note that GoogleTest is not downloaded automatically when running tests for the first time, which is not the recommended usage for it, but this project is just for learning.
Since GoogleTest is written in C++, the test files are also C++ files but call the C code using FFI.
To run the tests, use:
make tests
- C properties
- Creating Makefiles for projects with multiple files
- Using GDB
- Creating and using
clang-format
- Making syscalls directly from C
- Pipes and communication between processes
- IO redirection
- Writing tests in C
- Input parsing
- Basic FFI use