blob: 0d689ef8f8cded86182f2258d2bd8df99a02d678 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
/* ISC license. */
#include <sys/types.h>
#include <errno.h>
#include <skalibs/buffer.h>
ssize_t buffer_get (buffer *b, char *s, size_t len)
{
size_t w = 0 ;
int r = buffer_getall(b, s, len, &w) ;
return r == -1 ? errno == EPIPE ? (errno = 0, (ssize_t)w) : -1 :
!r ? (errno = EWOULDBLOCK, -1) : w ;
}
|