1buffer_get_new_token_sa_predL(i3b)rary Functions Manbuuaflfer_get_new_token_sa_pred(3)
2
3
4

NAME

6       buffer_get_new_token_sa_pred - read token from buffer
7

SYNTAX

9       #include <stralloc.h>
10       #include <buffer.h>
11
12       int buffer_get_new_token_sa_pred(buffer* b,stralloc* sa,
13                        int (*predicate)(stralloc* * sa));
14

DESCRIPTION

16       buffer_get_token_sa_pred  copies  data from b to sa until predicate(sa)
17       returns 1 or -1.
18
19       If predicate returns 1 once a '\n' was read, that new-line character is
20       still  appended to sa -- use stralloc_chop or stralloc_chomp to get rid
21       of it.  predicate can  also  return  0  (indicating  further  input  is
22       required to complete the token) or -1 (abort and return -1; use this if
23       predicate wants to enfore a maximum message size or does  timeout  han‐
24       dling or detects a malformed message).
25
26       If   reading   from   the  buffer  or  allocating  memory  fails,  buf‐
27       fer_get_new_token_sa_pred returns -1 and sets errno appropriately.   At
28       that point sa may already contain a partial token.
29
30       On success, buffer_get_new_token_sa_pred returns 0.
31
32       If   you   want   to   read   from  a  non-blocking  socket,  use  buf‐
33       fer_get_token_sa_pred instead.
34

SEE ALSO

36       buffer_getline_sa(3), buffer_get_token(3), buffer(3)
37
38
39
40                                               buffer_get_new_token_sa_pred(3)
Impressum