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

#include <stddef.h>

#include <skalibs/allreadwrite.h>
#include <skalibs/buffer.h>

ssize_t buffer_get (buffer *b, char *s, size_t len)
{
  size_t w = 0 ;
  ssize_t r = unsanitize_read(buffer_getall(b, s, len, &w)) ;
  return r < 0 ? r : w ;
}