rpm  4.12.0.1
Files | Functions
Argument Manipulation API.

Files

file  argv.h
 

Functions

void argvPrint (const char *msg, ARGV_const_t argv, FILE *fp)
 Print argv array elements. More...
 
ARGI_t argiFree (ARGI_t argi)
 Destroy an argi array. More...
 
ARGV_t argvNew (void)
 Create an empty argv array. More...
 
ARGV_t argvFree (ARGV_t argv)
 Destroy an argv array. More...
 
int argiCount (ARGI_const_t argi)
 Return no. More...
 
ARGint_t argiData (ARGI_const_t argi)
 Return data from argi array. More...
 
int argvCount (ARGV_const_t argv)
 Return no. More...
 
ARGV_t argvData (ARGV_t argv)
 Return data from argv array. More...
 
int argvCmp (const void *a, const void *b)
 Compare argv arrays (qsort/bsearch). More...
 
int argvSort (ARGV_t argv, int(*compar)(const void *, const void *))
 Sort an argv array. More...
 
ARGV_t argvSearch (ARGV_const_t argv, const char *val, int(*compar)(const void *, const void *))
 Find an element in an argv array. More...
 
int argiAdd (ARGI_t *argip, int ix, int val)
 Add an int to an argi array. More...
 
int argvAdd (ARGV_t *argvp, const char *val)
 Add a string to an argv array. More...
 
int argvAddNum (ARGV_t *argvp, int val)
 Add a number to an argv array (converting to a string). More...
 
int argvAppend (ARGV_t *argvp, ARGV_const_t av)
 Append one argv array to another. More...
 
ARGV_t argvSplitString (const char *str, const char *seps, argvFlags flags)
 Split a string into an argv array. More...
 
int argvSplit (ARGV_t *argvp, const char *str, const char *seps)
 Split a string into an argv array. More...
 
char * argvJoin (ARGV_const_t argv, const char *sep)
 Join an argv array into a string. More...
 

Detailed Description

Function Documentation

int argiAdd ( ARGI_t argip,
int  ix,
int  val 
)

Add an int to an argi array.

Return values
*argipargi array
Parameters
ixargi array index (or -1 to append)
valint arg to add
Returns
0 always
int argiCount ( ARGI_const_t  argi)

Return no.

of elements in argi array.

Parameters
argiargi array
Returns
no. of elements
ARGint_t argiData ( ARGI_const_t  argi)

Return data from argi array.

Parameters
argiargi array
Returns
argi array data address
ARGI_t argiFree ( ARGI_t  argi)

Destroy an argi array.

Parameters
argiargi array
Returns
NULL always
int argvAdd ( ARGV_t argvp,
const char *  val 
)

Add a string to an argv array.

Return values
*argvpargv array
Parameters
valstring arg to append
Returns
0 always
int argvAddNum ( ARGV_t argvp,
int  val 
)

Add a number to an argv array (converting to a string).

Return values
*argvpargv array
Parameters
valnumeric arg to append
Returns
0 always
int argvAppend ( ARGV_t argvp,
ARGV_const_t  av 
)

Append one argv array to another.

Return values
*argvpargv array
Parameters
avargv array to append
Returns
0 always
int argvCmp ( const void *  a,
const void *  b 
)

Compare argv arrays (qsort/bsearch).

Parameters
a1st instance address
b2nd instance address
Returns
result of comparison
int argvCount ( ARGV_const_t  argv)

Return no.

of elements in argv array.

Parameters
argvargv array
Returns
no. of elements
ARGV_t argvData ( ARGV_t  argv)

Return data from argv array.

Parameters
argvargv array
Returns
argv array data address
ARGV_t argvFree ( ARGV_t  argv)

Destroy an argv array.

Parameters
argvargv array
Returns
NULL always

Referenced by main().

char* argvJoin ( ARGV_const_t  argv,
const char *  sep 
)

Join an argv array into a string.

Parameters
*argvargv array to join
sepseparator string to use
Returns
malloc'ed string

Referenced by build().

ARGV_t argvNew ( void  )

Create an empty argv array.

Returns
pointer to empty argv
void argvPrint ( const char *  msg,
ARGV_const_t  argv,
FILE *  fp 
)

Print argv array elements.

Parameters
msgoutput message prefix (or NULL)
argvargv array
fpoutput file handle (NULL uses stderr)
ARGV_t argvSearch ( ARGV_const_t  argv,
const char *  val,
int(*)(const void *, const void *)  compar 
)

Find an element in an argv array.

Parameters
argvargv array
valstring to find
comparstrcmp-like comparison function, or NULL for argvCmp()
Returns
found string (NULL on failure)
int argvSort ( ARGV_t  argv,
int(*)(const void *, const void *)  compar 
)

Sort an argv array.

Parameters
argvargv array
comparstrcmp-like comparison function, or NULL for argvCmp()
Returns
0 always
int argvSplit ( ARGV_t argvp,
const char *  str,
const char *  seps 
)

Split a string into an argv array.

Return values
*argvpargv array
Parameters
strstring arg to split
sepsseparator characters
Returns
0 always

Referenced by buildArgCallback().

ARGV_t argvSplitString ( const char *  str,
const char *  seps,
argvFlags  flags 
)

Split a string into an argv array.

Parameters
strstring arg to split
sepsseparator characters
flagsflags to control behavior
Returns
argv array