2025-08-05 12:10:12 -03:00
2025-08-05 17:20:16 -03:00
2025-08-05 12:10:12 -03:00
2025-08-05 17:20:16 -03:00
2025-08-05 11:51:38 -03:00
2025-08-05 11:51:38 -03:00
2025-08-05 11:51:38 -03:00
2025-08-05 17:17:29 -03:00
2025-08-05 11:51:38 -03:00
2025-08-05 11:51:38 -03:00
2025-08-05 12:10:12 -03:00

C Template

C Template is a minimal C99 project boilerplate that includes basic argument parsing, structured logging, and a simple build setup. It is designed to help you bootstrap new C projects quickly and consistently.


Features

  • C99-compliant codebase
  • Basic command-line argument parsing
  • Structured logging system
  • Ready to clone and rename

Getting Started

1. Clone the Template

git clone https://git.bzd.gg/brenozd/c-template.git
cd c-template

2. Initialize pre-commit hooks

pre-commit install --hook-type commit-msg --hook-type pre-push

3. Replace Project Identifiers

Substitute all occurrences of c-template and c_template with your new project's name:

# Set your project name (e.g., "my-awesome-project")
your_project_name="my-awesome-project"

# Convert to C macro style (uppercase, hyphens to underscores)
macro_name=$(echo "$your_project_name" | tr '[:lower:]-' '[:upper:]_')

# Replace all instances
grep -rl 'c-template' src/ include/ | xargs sed -i "s/c-template/$your_project_name/g"
grep -rl 'c_template' src/ include/ | xargs sed -i "s/c_template/$(echo "$your_project_name" | tr '-' '_')/g"
grep -rl 'C_TEMPLATE' src/ include/ | xargs sed -i "s/C_TEMPLATE/$macro_name/g"

Build & Run

To build the project:

cmake -S $(pwd) -B build -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build --

To run the binary:

./build/bin/c_template --help

License

This project is licensed under the MIT License. See LICENSE for details.


Description
C Template repository
Readme 55 KiB
Languages
C 55.2%
CMake 38.9%
Shell 5.9%