aboutsummaryrefslogtreecommitdiff
path: root/src/str.h
diff options
context:
space:
mode:
authorElis Eriksson <spelis@spelis.li>2026-06-13 17:40:25 +0200
committerElis Eriksson <spelis@spelis.li>2026-06-13 17:40:25 +0200
commit7ccae1c362a45b28f4fbf96da4f479730e4b382b (patch)
treef59ba4d76221590901784464a03a6a871d774305 /src/str.h
downloadbfc-7ccae1c362a45b28f4fbf96da4f479730e4b382b.tar
bfc-7ccae1c362a45b28f4fbf96da4f479730e4b382b.tar.gz
bfc-7ccae1c362a45b28f4fbf96da4f479730e4b382b.tar.bz2
bfc-7ccae1c362a45b28f4fbf96da4f479730e4b382b.tar.lz
bfc-7ccae1c362a45b28f4fbf96da4f479730e4b382b.tar.xz
bfc-7ccae1c362a45b28f4fbf96da4f479730e4b382b.tar.zst
bfc-7ccae1c362a45b28f4fbf96da4f479730e4b382b.zip
Initial Commit, probably needs heavy code cleanup
Diffstat (limited to 'src/str.h')
-rw-r--r--src/str.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/str.h b/src/str.h
new file mode 100644
index 0000000..416a846
--- /dev/null
+++ b/src/str.h
@@ -0,0 +1,22 @@
+#pragma once
+
+#include <stddef.h>
+#include <stdio.h>
+
+typedef struct {
+ char *data;
+ size_t length;
+ size_t capacity;
+} str;
+
+void free_str(str *s);
+
+void str_append(str *s, const char *from);
+void str_append_c(str *s, char c);
+void str_append_len(str *s, const char *from, size_t len);
+
+void str_append_read(str *s, int fd);
+void str_append_fread(str *s, FILE *file);
+void str_append_fread_len(str *s, size_t size, FILE *file);
+
+void str_appendf(str *s, const char *fmt, ...);