diff options
-rw-r--r-- | rpmio/argv.c | 11 | ||||
-rw-r--r-- | rpmio/argv.h | 8 |
2 files changed, 19 insertions, 0 deletions
diff --git a/rpmio/argv.c b/rpmio/argv.c index 302f71d12..0ff05acf0 100644 --- a/rpmio/argv.c +++ b/rpmio/argv.c @@ -5,6 +5,7 @@ #include "system.h" #include <rpm/argv.h> +#include <rpm/rpmstring.h> #include "debug.h" @@ -141,6 +142,16 @@ int argvAdd(ARGV_t * argvp, const char *val) return 0; } +int argvAddNum(ARGV_t *argvp, int val) +{ + char *valstr = NULL; + int rc; + rasprintf(&valstr, "%d", val); + rc = argvAdd(argvp, valstr); + free(valstr); + return rc; +} + int argvAppend(ARGV_t * argvp, ARGV_const_t av) { ARGV_t argv = *argvp; diff --git a/rpmio/argv.h b/rpmio/argv.h index 6d5dc1f1a..043275236 100644 --- a/rpmio/argv.h +++ b/rpmio/argv.h @@ -123,6 +123,14 @@ int argiAdd(ARGI_t * argip, int ix, int val); int argvAdd(ARGV_t * argvp, const char *val); /** \ingroup rpmargv + * Add a number to an argv array (converting to a string). + * @retval *argvp argv array + * @param val numeric arg to append + * @return 0 always + */ +int argvAddNum(ARGV_t * argvp, int val); + +/** \ingroup rpmargv * Append one argv array to another. * @retval *argvp argv array * @param av argv array to append |