man buffer_get_token_pred () - read token from buffer

NAME

buffer_get_token_pred - read token from buffer

SYNTAX

#include <buffer.h>

int buffer_get_token_pred(buffer* b,char* x,unsigned long int len, int (*predicate)(const char* s,unsigned long int len));

DESCRIPTION

buffer_get_token_pred copies data from b to x[0], x[1], ..., x[len-1] until len bytes have been read or predicate called on the destination string returns nonzero.

predicate can also return 0 (indicating further input is required to complete the token) or -1 (abort and return -1; use this if predicate wants to enfore a maximum message size or does timeout handling or detects a malformed message).

buffer_get_token_pred returns the number of bytes copied or -1 on error (setting errno appropriately).

SEE ALSO