master xplshn/aruu / shared / text.h
 1/* See LICENSE file for copyright and license details. */
 2
 3#include <stddef.h>
 4#include <stdio.h>
 5#include <sys/types.h>
 6
 7struct line {
 8  char  *data;
 9  size_t len;
10};
11
12struct 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  }
23void getlines(FILE *, struct linebuf *);
24
25int linecmp(struct line *, struct line *);
26
27ssize_t agetline(char **, size_t *, FILE *);
28void    fconcat(FILE *, const char *, FILE *, const char *);