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

#include <skalibs/buffer.h>
#include <skalibs/stralloc.h>
#include <execline/execline.h>

static int next (unsigned char *c, void *p)
{
  register int 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) ;
}