summaryrefslogtreecommitdiff
path: root/src/libexecline/el_parse_from_buffer.c
blob: 62a63ce389af0d802172706ea7abfb02453dea58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* ISC license. */

#include <sys/types.h>
#include <skalibs/buffer.h>
#include <execline/execline.h>

static int next (unsigned char *c, void *p)
{
  ssize_t r = buffer_get((buffer *)p, (char *)c, 1) ;
  if (r < 0) return 0 ;
  if (!r) *c = 0 ;
  return 1 ;
}

int el_parse_from_buffer (stralloc *sa, buffer *b)
{
  return el_parse(sa, &next, b) ;
}