1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| | /* SPDX-License-Identifier: AGPL-3.0-or-later
* Copyright Red Hat
* Author: David Gibson <david(a)gibson.dropbear.id.au>
*/
#ifndef LINEREAD_H
#define LINEREAD_H
#define LINEREAD_BUFFER_SIZE 8192
struct lineread {
int fd;
int next_line; /* start of next unread line in buffer */
int count; /* number of unreturned bytes in buffer */
/* One extra byte for possible trailing \0 */
char buf[LINEREAD_BUFFER_SIZE+1];
};
void lineread_init(struct lineread *lr, int fd);
int lineread_get(struct lineread *lr, char **line);
#endif /* _LINEREAD_H */
|