1buffer_getline_sa(3) Library Functions Manual buffer_getline_sa(3)
2
3
4
6 buffer_getline_sa - read line from buffer
7
9 #include <stralloc.h>
10 #include <buffer.h>
11
12 int buffer_getline_sa(buffer* b,stralloc* sa);
13
15 buffer_getline_sa appends data from the b to sa until a '\n' is found,
16 NOT overwriting the previous content of sa. The new-line is also
17 appended to sa.
18
19 If reading from the buffer or allocating memory fails, buffer_get‐
20 line_sa returns -1 and sets errno appropriately. At that point sa may
21 be empty or it may already contain a partial token.
22
24 -1 on error (setting errno), 0 on EOF, 1 when successful.
25
27 buffer_getline_sa appends instead of overwriting so it can be used on
28 non-blocking sockets (these signal error and set errno to EAGAIN; in
29 this case you can simply call buffer_getline_sa again when select or
30 poll indicate more data is available).
31
33 buffer_get_token_sa(3), buffer(3)
34
35
36
37 buffer_getline_sa(3)