text.h (959B)
1 /* see LICENSE file for copyright and license details */ 2 3 #include <stddef.h> 4 #include <stdio.h> 5 #include <sys/types.h> 6 7 struct line { 8 char *data; 9 size_t len; 10 }; 11 12 struct linebuf { 13 struct line *lines; 14 size_t nlines; 15 size_t capacity; 16 }; 17 #define EMPTY_LINEBUF \ 18 { \ 19 NULL, \ 20 0, \ 21 0, \ 22 } 23 void getlines(FILE *, struct linebuf *); 24 25 int linecmp(struct line *, struct line *); 26 27 ssize_t agetline(char **, size_t *, FILE *); 28 void fconcat(FILE *, const char *, FILE *, const char *);