Add argvAddNum() for adding integers to ARGV_t arrays
This commit is contained in:
parent
d858e4ffa5
commit
900cbb7d79
11
rpmio/argv.c
11
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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue