rpmio/argv.c File Reference

#include "system.h"
#include <argv.h>
#include "debug.h"

Go to the source code of this file.

Functions

static void * _free (const void *p)
 Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
void argvPrint (const char *msg, ARGV_t argv, FILE *fp)
 Print argv array elements.
ARGI_t argiFree (ARGI_t argi)
 Destroy an argi array.
ARGV_t argvFree (ARGV_t argv)
 Destroy an argv array.
int argiCount (ARGI_t argi)
 Return no.
const ARGint_t argiData (const ARGI_t argi)
 Return data from argi array.
int argvCount (const ARGV_t argv)
 Return no.
const ARGV_t argvData (const ARGV_t argv)
 Return data from argv array.
int argvCmp (const void *a, const void *b)
 Compare argv arrays (qsort/bsearch).
int argvSort (ARGV_t argv, int(*compar)(const void *, const void *))
 Sort an argv array.
ARGV_t argvSearch (ARGV_t argv, ARGstr_t val, int(*compar)(const void *, const void *))
 Find an element in an argv array.
int argiAdd (ARGI_t *argip, int ix, int val)
 Add an int to an argi array.
int argvAdd (ARGV_t *argvp, ARGstr_t val)
 Add a string to an argv array.
int argvAppend (ARGV_t *argvp, const ARGV_t av)
 Append one argv array to another.
int argvSplit (ARGV_t *argvp, const char *str, const char *seps)
 Split a string into an argv array.


Detailed Description

Definition in file argv.c.


Function Documentation

static void* _free ( const void *  p  )  [inline, static]

Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.

Parameters:
p memory to free
Returns:
NULL always

Definition at line 18 of file argv.c.

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

Add an int to an argi array.

Return values:
*argip argi array
Parameters:
ix argi array index (or -1 to append)
val int arg to add
Returns:
0 always

Definition at line 122 of file argv.c.

References ARGI_s::nvals, ARGI_s::vals, xcalloc(), and xrealloc().

Referenced by rpmfcApply(), and rpmfcClassify().

int argiCount ( const ARGI_t  argi  ) 

Return no.

of elements in argi array.

Parameters:
argi argi array
Returns:
no. of elements

Definition at line 63 of file argv.c.

References ARGI_s::nvals.

Referenced by main(), rpmfcApply(), and rpmfcGenerateDepends().

const ARGint_t argiData ( const ARGI_t  argi  ) 

Return data from argi array.

Parameters:
argi argi array
Returns:
argi array data address

Definition at line 71 of file argv.c.

References ARGI_s::nvals, and ARGI_s::vals.

Referenced by rpmfcGenerateDepends().

ARGI_t argiFree ( ARGI_t  argi  ) 

Destroy an argi array.

Parameters:
argi argi array
Returns:
NULL always

Definition at line 40 of file argv.c.

References _free(), ARGI_s::nvals, and ARGI_s::vals.

Referenced by rpmfcFree().

int argvAdd ( ARGV_t argvp,
ARGstr_t  val 
)

Add a string to an argv array.

Return values:
*argvp argv array
Parameters:
val string arg to append
Returns:
0 always

Definition at line 143 of file argv.c.

References argvCount(), xrealloc(), and xstrdup().

Referenced by main(), rpmfcClassify(), and rpmfcSaveArg().

int argvAppend ( ARGV_t argvp,
const ARGV_t  av 
)

Append one argv array to another.

Return values:
*argvp argv array
Parameters:
av argv array to append
Returns:
0 always

Definition at line 160 of file argv.c.

References argvCount(), xrealloc(), and xstrdup().

Referenced by rpmfcExec(), and rpmgiGlobArgv().

int argvCmp ( const void *  a,
const void *  b 
)

Compare argv arrays (qsort/bsearch).

Parameters:
a 1st instance address
b 2nd instance address
Returns:
result of comparison

Definition at line 95 of file argv.c.

Referenced by argvSearch(), and argvSort().

int argvCount ( const ARGV_t  argv  ) 

Return no.

of elements in argv array.

Parameters:
argv argv array
Returns:
no. of elements

Definition at line 79 of file argv.c.

Referenced by argvAdd(), argvAppend(), argvSearch(), argvSort(), main(), rpmfcApply(), rpmfcClassify(), rpmfcExpandAppend(), rpmfcGenerateDepends(), and rpmfcHelper().

const ARGV_t argvData ( const ARGV_t  argv  ) 

Return data from argv array.

Parameters:
argv argv array
Returns:
argv array data address

Definition at line 88 of file argv.c.

Referenced by rpmfcGenerateDepends().

ARGV_t argvFree ( ARGV_t  argv  ) 

Destroy an argv array.

Parameters:
argv argv array
Returns:
NULL always

Definition at line 50 of file argv.c.

References _free().

Referenced by rpmfcClassify(), rpmfcExec(), rpmfcFree(), rpmfcGenerateDepends(), rpmfcHelper(), rpmgiFree(), and rpmgiGlobArgv().

void argvPrint ( const char *  msg,
ARGV_t  argv,
FILE *  fp 
)

Print argv array elements.

Parameters:
msg output message prefix (or NULL)
argv argv array
fp output file handle (NULL uses stderr)

Definition at line 25 of file argv.c.

ARGV_t argvSearch ( ARGV_t  argv,
ARGstr_t  val,
int(*)(const void *, const void *)  compar 
)

Find an element in an argv array.

Parameters:
argv argv array
val string to find
compar strcmp-like comparison function, or NULL for argvCmp()
Returns:
found string (NULL on failure)

Definition at line 112 of file argv.c.

References argvCmp(), and argvCount().

Referenced by rpmfcClassify(), and rpmfcSaveArg().

int argvSort ( ARGV_t  argv,
int(*)(const void *, const void *)  compar 
)

Sort an argv array.

Parameters:
argv argv array
compar strcmp-like comparison function, or NULL for argvCmp()
Returns:
0 always

Definition at line 104 of file argv.c.

References argvCmp(), and argvCount().

Referenced by main(), and rpmfcSaveArg().

int argvSplit ( ARGV_t argvp,
const char *  str,
const char *  seps 
)

Split a string into an argv array.

Return values:
*argvp argv array
Parameters:
str string arg to split
seps seperator characters
Returns:
0 always

Definition at line 175 of file argv.c.

References alloca(), xmalloc(), and xstrdup().

Referenced by rpmfcHelper().


Generated on Fri Oct 12 08:44:56 2007 for rpm by  doxygen 1.5.2