commit a20c931ff50909a4655bd746aa65b460d61c7d74
parent 596d3e868e617aa97b62a7f77ee79c60c80c7a5c
Author: finwo <finwo@pm.me>
Date: Wed, 26 Aug 2026 22:18:06 +0200
Add minimal readme
Diffstat:
| M | Makefile | | | 5 | ++++- |
| A | README.md | | | 66 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| M | src/cnfparse.h | | | 59 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
3 files changed, 129 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
@@ -21,7 +21,7 @@ CFLAGS+=$(INCLUDES)
LDFLAGS+=$(CFLAGS)
.PHONY: default
-default: $(BIN)
+default: $(BIN) README.md
.c.o:
$(CC) $(CFLAGS) -c -o $@ $<
@@ -32,3 +32,6 @@ $(BIN): $(OBJ)
.PHONY: clean
clean:
rm -rf $(OBJ)
+
+README.md: src/cnfparse.h
+ stddoc < src/cnfparse.h > README.md
diff --git a/README.md b/README.md
@@ -0,0 +1,66 @@
+finwo/cnfparse
+==============
+
+> Small library to make config parsing easier
+
+This library makes use of [dep](https://github.com/finwo/dep) to manage it's
+dependencies and exports.
+
+Installation
+------------
+
+```sh
+dep add finwo/cnfparse
+dep install
+```
+
+After that, simply add `include lib/.dep/config.mk` in your makefile and include
+the header file by adding `#include "finwo/cnfparse.h`.
+
+API
+---
+
+### Structures
+
+<details>
+ <summary>struct cnf_directive</summary>
+
+ The main handle of the cnfparse library
+
+```C
+struct cnf_directive {
+ char *name;
+ size_t argc;
+ char **argv;
+};
+```
+
+</details>
+
+### Methods
+
+<details>
+ <summary>cnf_directive_free(subject)</summary>
+
+ Frees the memory used by a directive
+
+```C
+void cnf_directive_free(struct cnf_directive *subject);
+```
+
+</details>
+<details>
+ <summary>cnf_directive_read(fd)</summary>
+
+ Returns a single directive (or NULL) from the file descriptor
+
+```C
+struct cnf_directive * cnf_directive_read(FILE *fd);
+```
+
+</details>
+
+License
+-------
+
+cnfparse.c source code is available under the [FGPL License](LICENSE.md)
diff --git a/src/cnfparse.h b/src/cnfparse.h
@@ -1,16 +1,75 @@
#ifndef __FINWO_CNFPARSE_H__
#define __FINWO_CNFPARSE_H__
+/// finwo/cnfparse
+/// ==============
+///
+/// > Small library to make config parsing easier
+///
+/// This library makes use of [dep](https://github.com/finwo/dep) to manage it's
+/// dependencies and exports.
+///
+/// Installation
+/// ------------
+///
+/// ```sh
+/// dep add finwo/cnfparse
+/// dep install
+/// ```
+///
+/// After that, simply add `include lib/.dep/config.mk` in your makefile and include
+/// the header file by adding `#include "finwo/cnfparse.h`.
+///
+
#include <stddef.h>
#include <stdio.h>
+/// API
+/// ---
+
+///
+/// ### Structures
+///
+
+/// <details>
+/// <summary>struct cnf_directive</summary>
+///
+/// The main handle of the cnfparse library
+///<C
struct cnf_directive {
char *name;
size_t argc;
char **argv;
};
+///>
+/// </details>
+///
+/// ### Methods
+///
+
+/// <details>
+/// <summary>cnf_directive_free(subject)</summary>
+///
+/// Frees the memory used by a directive
+///<C
void cnf_directive_free(struct cnf_directive *subject);
+///>
+/// </details>
+
+/// <details>
+/// <summary>cnf_directive_read(fd)</summary>
+///
+/// Returns a single directive (or NULL) from the file descriptor
+///<C
struct cnf_directive * cnf_directive_read(FILE *fd);
+///>
+/// </details>
#endif // __FINWO_CNFPARSE_H__
+
+///
+/// License
+/// -------
+///
+/// cnfparse.c source code is available under the [FGPL License](LICENSE.md)