aboutsummaryrefslogtreecommitdiff
path: root/lib/include
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-04-02 21:26:45 +0200
committerDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-04-04 00:03:28 +0200
commit352a9060b6813c41527f0c5da43f0c86aecfde2a (patch)
tree25103794889d8a3b900632611b70f162b95ca0a6 /lib/include
parentdc5afbc7712b49ec130088d0ccae327db61bd97b (diff)
Add statefull preprocessing to rdline
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'lib/include')
-rw-r--r--lib/include/util.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/include/util.h b/lib/include/util.h
index 9ba9ffb..6943567 100644
--- a/lib/include/util.h
+++ b/lib/include/util.h
@@ -43,6 +43,18 @@ typedef struct {
cleared if end-of-file is reached.
The line must be deallocated with free().
+
+ The following transformations are applied:
+ - Space characters are replaced with regular white space characters.
+ - Sequences of space characters are truncated to a single space.
+ - A '#' sign is interpreted as the start of a comment and removed,
+ together with everything that follows.
+ - Padding spaces are removed from the line.
+ - If a '"' is encounterd, the above rules are disabled, until a
+ after the matching '"' is read. A '"' can be escaped by preceeding
+ it with a backslash.
+ - If a second, coresponding '"' is not found, processing fails with
+ errno set to EILSEQ.
*/
char *rdline(int fd);