From 58214ec5f982c1b97aadce254c958a5f922c9724 Mon Sep 17 00:00:00 2001 From: wrmr Date: Sat, 2 Nov 2024 15:10:41 -0500 Subject: split main.c in several places, began work on design doc --- parse.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 parse.c (limited to 'parse.c') 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; + } +} -- cgit 1.4.1-2-gfad0