summary refs log tree commit diff
path: root/parse.c
diff options
context:
space:
mode:
authorwrmr2024-11-02 15:10:41 -0500
committerwrmr2024-11-02 15:10:41 -0500
commit58214ec5f982c1b97aadce254c958a5f922c9724 (patch)
treeae64cb697531b0ee619350645e47adf186febfe7 /parse.c
parentdf1b0b23569e5244d5b9398802fec6435a995368 (diff)
split main.c in several places, began work on design doc
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/parse.c b/parse.c
new file mode 100644
index 0000000..8061257
--- /dev/null
+++ b/parse.c
@@ -0,0 +1,17 @@
+#include "parse.h"
+
+int parse_doc(enum doc_type doct, int (*line_get)(char **, size_t *)) {
+	char *s;
+	size_t n;
+	switch (doct) {
+	case TYPE_PLAIN:
+		doc_new();
+		while (line_get(&s, &n)) {
+			doc_add(s, n);
+			doc_add("\n", 1);
+		}
+		return 0;
+	default:
+		return -1;
+	}
+}