summary refs log tree commit diff
path: root/str.c
diff options
context:
space:
mode:
authorwrmr2024-11-09 02:21:35 -0500
committerwrmr2024-11-09 02:21:35 -0500
commit4ca7853b000048514f5bf18391db2e66f65d1377 (patch)
treecbb4450195c2ec813fc7689fd62a8524a657c8c5 /str.c
parent2780add3f90c284cbb08f2b3a2ad83aeb472d4e0 (diff)
add strv_next
Diffstat (limited to 'str.c')
-rw-r--r--str.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/str.c b/str.c
index 10d64e1..e0ea194 100644
--- a/str.c
+++ b/str.c
@@ -58,3 +58,12 @@ int strv_split(strv_t *src, int chr, strv_t *dest) {
 	src->n -= dest->n + !!c;
 	return dest->n > 0;
 }
+
+char strv_next(strv_t *s) {
+	if (s->n > 0) {
+		s->n--;
+		return *(s->s++);
+	} else {
+		return 0;
+	}
+}