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

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

int cbuffer_init (cbuffer_t *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 ;
}