summaryrefslogtreecommitdiff
path: root/src/libstddjb/cbuffer_get.c
blob: c490c26d457e388a376df31881f8aaca2960767a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* ISC license. */

#include <sys/types.h>
#include <sys/uio.h>
#include <skalibs/siovec.h>
#include <skalibs/cbuffer.h>

size_t cbuffer_get (cbuffer_t *b, char *s, size_t len)
{
  struct iovec v[2] ;
  size_t w ;
  cbuffer_rpeek(b, v) ;
  w = siovec_gather(v, 2, s, len) ;
  return cbuffer_RSEEK(b, w) ;
}