File: buffer_get_token_pred.3

package info (click to toggle)
libowfat 0.27-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,412 kB
  • ctags: 1,147
  • sloc: ansic: 12,294; makefile: 42
file content (23 lines) | stat: -rw-r--r-- 954 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
.TH buffer_get_token_pred 3
.SH NAME
buffer_get_token_pred \- read token from buffer
.SH SYNTAX
.B #include <buffer.h>

ssize_t \fBbuffer_get_token_pred\fP(buffer* \fIb\fR,char* \fIx\fR,size_t \fIlen\fR,
                 int (*\fIpredicate\fR)(const char* \fIs\fR,size_t \fIlen\fR));
.SH DESCRIPTION
buffer_get_token_pred copies data from \fIb\fR to \fIx\fR[0],
\fIx\fR[1], ..., \fIx\fR[\fIlen\fR-1] until \fIlen\fR bytes have been
read or \fIpredicate\fR called on the destination string returns
nonzero.

\fIpredicate\fR can also return 0 (indicating further input is required
to complete the token) or -1 (abort and return -1; use this if
\fIpredicate\fR 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 \fIerrno\fR appropriately).
.SH "SEE ALSO"
buffer_init(3), buffer_feed(3), buffer_peek(3), buffer_seek(3), buffer(3)