From 75c5483115a4b5309c6f2c7517865d7444eac49d Mon Sep 17 00:00:00 2001 From: Francesco Date: Fri, 29 May 2026 13:49:01 +0200 Subject: [PATCH] chore: initial files --- .clang-format | 10 ++++++++++ include/meson.build | 1 + include/minihttp.h | 4 ++++ include/parser.h | 4 ++++ include/request.h | 4 ++++ meson.build | 41 +++++++++++++++++++++++++++++++++++++++++ src/meson.build | 1 + src/parser.c | 1 + src/request.c | 1 + test/test1.c | 7 +++++++ 10 files changed, 74 insertions(+) create mode 100644 .clang-format create mode 100644 include/meson.build create mode 100644 include/minihttp.h create mode 100644 include/parser.h create mode 100644 include/request.h create mode 100644 meson.build create mode 100644 src/meson.build create mode 100644 src/parser.c create mode 100644 src/request.c create mode 100644 test/test1.c diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..4a008c4 --- /dev/null +++ b/.clang-format @@ -0,0 +1,10 @@ +BasedOnStyle: LLVM +UseTab: Always +TabWidth: 4 +IndentWidth: 4 +IndentCaseLabels: true +ColumnLimit: 120 +PointerAlignment: Right +AllowShortFunctionsOnASingleLine: None +InsertBraces: true +AllowShortBlocksOnASingleLine: Empty diff --git a/include/meson.build b/include/meson.build new file mode 100644 index 0000000..b7e9dd7 --- /dev/null +++ b/include/meson.build @@ -0,0 +1 @@ +headers += files('minihttp.h', 'parser.h', 'request.h',) diff --git a/include/minihttp.h b/include/minihttp.h new file mode 100644 index 0000000..6c9a67d --- /dev/null +++ b/include/minihttp.h @@ -0,0 +1,4 @@ +#ifndef MINIHTTP_MINIHTTP_H +#define MINIHTTP_MINIHTTP_H + +#endif diff --git a/include/parser.h b/include/parser.h new file mode 100644 index 0000000..6df7ef2 --- /dev/null +++ b/include/parser.h @@ -0,0 +1,4 @@ +#ifndef MINIHTTP_PARSER_H +#define MINIHTTP_PARSER_H + +#endif diff --git a/include/request.h b/include/request.h new file mode 100644 index 0000000..b5e743a --- /dev/null +++ b/include/request.h @@ -0,0 +1,4 @@ +#ifndef MINIHTTP_REQUEST_H +#define MINIHTTP_REQUEST_H + +#endif diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..1c7545b --- /dev/null +++ b/meson.build @@ -0,0 +1,41 @@ +project( + 'minihttp', + 'c', + version: '0.1', + default_options: ['warning_level=3', 'c_std=c17'], +) + +sources = [] +headers = [] +subdir('src') +subdir('include') + +incdir = include_directories('include') + +deps = [] + +libminihttp = static_library( + 'minihttp', + sources, + dependencies: deps, + install: true, + include_directories: incdir, +) +install_headers(headers, install_dir: 'minihttp') + +# Test executable +exesrc = files('test/test1.c') +executable( + 'httptest', + exesrc, + build_by_default: false, + link_with: libminihttp, + include_directories: incdir, +) + +# Commands +clangformat = find_program('clang-format', required: false) +if clangformat.found() + all_files = sources + headers + exesrc + run_target('format', command: [clangformat, '-i'] + all_files) +endif diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..0a3c45a --- /dev/null +++ b/src/meson.build @@ -0,0 +1 @@ +sources += files('parser.c', 'request.c',) diff --git a/src/parser.c b/src/parser.c new file mode 100644 index 0000000..c1dfa96 --- /dev/null +++ b/src/parser.c @@ -0,0 +1 @@ +#include "parser.h" diff --git a/src/request.c b/src/request.c new file mode 100644 index 0000000..2b671df --- /dev/null +++ b/src/request.c @@ -0,0 +1 @@ +#include "request.h" diff --git a/test/test1.c b/test/test1.c new file mode 100644 index 0000000..1643fcc --- /dev/null +++ b/test/test1.c @@ -0,0 +1,7 @@ +#include + +int main(void) { + puts("minihttp"); + + return 0; +}