From 35052b96232810cbf0d91a4f1d1d3ff25a142fd0 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Mon, 15 Mar 2010 11:54:55 +0200 Subject: Add an enhanced argvSplitString() function for splitting strings to argv's - Returns the newly created argv instead of useless "this always returns 0" - By default make a "real" split, including empty strings - Flags argument allows controlling behavior, for now only flag is to preserve argvSplit() behavior but leaves room for future enhancements such as quoted splitting etc --- rpmio/argv.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'rpmio/argv.h') diff --git a/rpmio/argv.h b/rpmio/argv.h index 6a6fc7f14..86ec1373a 100644 --- a/rpmio/argv.h +++ b/rpmio/argv.h @@ -138,6 +138,20 @@ int argvAddNum(ARGV_t * argvp, int val); */ int argvAppend(ARGV_t * argvp, ARGV_const_t av); +typedef enum argvFlags_e { + ARGV_NONE = 0, + ARGV_SKIPEMPTY = (1 << 0), /* omit empty strings from result */ +} argvFlags; + +/** \ingroup rpmargv + * Split a string into an argv array. + * @param str string arg to split + * @param seps seperator characters + * @param flags flags to control behavior + * @return argv array + */ +ARGV_t argvSplitString(const char * str, const char * seps, argvFlags flags); + /** \ingroup rpmargv * Split a string into an argv array. * @retval *argvp argv array -- cgit v1.2.3