Add argvAddNum() for adding integers to ARGV_t arrays

This commit is contained in:
Panu Matilainen 2008-04-14 16:21:40 +03:00
parent d858e4ffa5
commit 900cbb7d79
2 changed files with 19 additions and 0 deletions

View File

@ -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;

View File

@ -122,6 +122,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