From ad541c67761b8aa6da1566802c347cac4018d0c2 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Mon, 2 Nov 2026 20:50:24 +0100 Subject: Move the build sources into src/ --- src/ot_fmt.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/ot_fmt.h (limited to 'src/ot_fmt.h') diff --git a/src/ot_fmt.h b/src/ot_fmt.h new file mode 100644 index 0000000..214cbc4 --- /dev/null +++ b/src/ot_fmt.h @@ -0,0 +1,19 @@ +/* This software was written by Dirk Engling + It is considered beerware. Prost. Skol. Cheers or whatever. */ + +#ifndef OT_FMT_H__ +#define OT_FMT_H__ + +#include + +/* Appending to a cursor that walks a fixed buffer. Both take the cursor by + reference and advance it, so a reply is written as a run of statements and + no caller does pointer arithmetic of its own. */ + +void fmt_append(char **cursor, const char *end, const char *format, ...) __attribute__((format(printf, 3, 4))); + +/* Append raw bytes for the binary stretches of a bencoded reply. + Either everything is appended or nothing at all */ +void fmt_bytes(char **cursor, const char *end, const void *bytes, size_t length); + +#endif -- cgit v1.3