aboutsummaryrefslogtreecommitdiffstats
path: root/src/libexecline/el_parse_from_buffer.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-03-26 12:47:19 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-03-26 12:47:19 +0000
commit9cf89b4437df6a7741532dd73fed770cd8eef9f2 (patch)
treeabdeb249d992b1ba90d44b838318d0d09c3369a2 /src/libexecline/el_parse_from_buffer.c
parentcfe736ed5615d6e00f4ce6704591782fe790a752 (diff)
downloadexecline-9cf89b4437df6a7741532dd73fed770cd8eef9f2.tar.gz
- added el_parse() and friends
- refactored execlineb to use them - version: rc for 2.1.1.1
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) ;
+}