From 391720cb430ad74d01dacb1cd53c06d6283aba4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 5 Apr 2017 12:40:43 +0200 Subject: text: introduce text_char_get which converts \r\n to \n --- text.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'text.h') diff --git a/text.h b/text.h index 8559b36..0e372c1 100644 --- a/text.h +++ b/text.h @@ -70,6 +70,9 @@ size_t text_lineno_by_pos(Text*, size_t pos); /* set `buf' to the byte found at `pos' and return true, if `pos' is invalid * false is returned and `buf' is left unmodified */ bool text_byte_get(Text*, size_t pos, char *buf); +/* same as byte get, but if a sequence of '\r\n' is read at `pos', + * `buf` is set to \n instead of \r. */ +bool text_char_get(Text*, size_t pos, char *buf); /* store at most `len' bytes starting from `pos' into `buf', the return value * indicates how many bytes were copied into `buf'. WARNING buf will not be * NUL terminated. */ -- cgit v1.2.3