aboutsummaryrefslogtreecommitdiffstats
path: root/src/libexecline/el_parse_from_buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexecline/el_parse_from_buffer.c')
-rw-r--r--src/libexecline/el_parse_from_buffer.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libexecline/el_parse_from_buffer.c b/src/libexecline/el_parse_from_buffer.c
new file mode 100644
index 0000000..802fe40
--- /dev/null
+++ b/src/libexecline/el_parse_from_buffer.c
@@ -0,0 +1,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) ;
+}