From c5aa6db64f6f43621568bb1fec9360c25dbd2749 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 25 Apr 2018 11:53:57 +0200 Subject: argv_array: offer to split a string by whitespace This is a simple function that will interpret a string as a whitespace delimited list of values, and add those values into the array. Note: this function does not (yet) offer to split by arbitrary delimiters, or keep empty values in case of runs of whitespace, or de-quote Unix shell style. All fo this functionality can be added later, when and if needed. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- argv-array.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'argv-array.h') diff --git a/argv-array.h b/argv-array.h index 29056e49a1..750c30d2f2 100644 --- a/argv-array.h +++ b/argv-array.h @@ -19,6 +19,8 @@ LAST_ARG_MUST_BE_NULL void argv_array_pushl(struct argv_array *, ...); void argv_array_pushv(struct argv_array *, const char **); void argv_array_pop(struct argv_array *); +/* Splits by whitespace; does not handle quoted arguments! */ +void argv_array_split(struct argv_array *, const char *); void argv_array_clear(struct argv_array *); const char **argv_array_detach(struct argv_array *); -- cgit v1.2.3