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

#include <errno.h>
#include <skalibs/cbuffer.h>

int cbuffer_init (cbuffer *b, char *s, size_t len)
{
  if (len < 2) return (errno = EINVAL, 0) ;
  b->x = s ;
  b->a = len ;
  b->p = b->n = 0 ;
  return 1 ;
}