aboutsummaryrefslogtreecommitdiff
path: root/parse.h
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-02-15 21:54:37 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-02-15 21:54:41 +0100
commit7c61575432904666ce169b3f01158d69d1693d74 (patch)
treeabb7239d10780d1889d6b111f948f8aefae899f1 /parse.h
parentAdd character escaping. (diff)
downloadcalp-7c61575432904666ce169b3f01158d69d1693d74.tar.gz
calp-7c61575432904666ce169b3f01158d69d1693d74.tar.xz
Move fold function.
Diffstat (limited to 'parse.h')
-rw-r--r--parse.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/parse.h b/parse.h
index ae48a351..b69bcfa5 100644
--- a/parse.h
+++ b/parse.h
@@ -52,4 +52,26 @@ int handle_kv(
int parse_file(char* filename, FILE* f, vcomponent* cal);
+/*
+ * Input
+ * f: file to get characters from
+ * ctx: current parse context
+ * c: last read character
+ * output:
+ * 0: line folded
+ * 1: line ended
+ *
+ * A carrige return means that the current line is at an
+ * end. The following character should always be \n.
+ * However, if the first character on the next line is a
+ * whitespace then the two lines should be concatenated.
+ *
+ * NOTE
+ * The above is true according to the standard. But I have
+ * found files with only NL. The code below ends line on the
+ * first of NL or CR, and then ensures that the program thinks
+ * it got the expected CRNL.
+ */
+int fold(FILE* f, parse_ctx* ctx, char c);
+
#endif /* PARSE_H */