aboutsummaryrefslogtreecommitdiff
path: root/src/str.h
diff options
context:
space:
mode:
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, ...);