rpm 4.15.1

Files | Functions
Argument Manipulation API.
I/O

Argument Manipulation API. More...

Collaboration diagram for Argument Manipulation API.:

## Files
file | argv.h

## Functions
void | argvPrint (const char *msg, ARGV_const_t argv, FILE *fp)
ARGI_t | argiFree (ARGI_t argi)
ARGV_t | argvNew (void)
ARGV_t | argvFree (ARGV_t argv)
int | argiCount (ARGI_const_t argi)
ARGint_t | argiData (ARGI_const_t argi)
int | argvCount (ARGV_const_t argv)
ARGV_t | argvData (ARGV_t argv)
int | argvCmp (const void *a, const void *b)
int | argvSort (ARGV_t argv, int(*compar)(const void *, const void *))
ARGV_t | argvSearch (ARGV_const_t argv, const char *val, int(*compar)(const void *, const void *))
int | argiAdd (ARGI_t *argip, int ix, int val)
int | argvAdd (ARGV_t *argvp, const char *val)
int | argvAddNum (ARGV_t *argvp, int val)
int | argvAppend (ARGV_t *argvp, ARGV_const_t av)
ARGV_t | argvSplitString (const char *str, const char *seps, argvFlags flags)
int | argvSplit (ARGV_t *argvp, const char *str, const char *seps)
char * | argvJoin (ARGV_const_t argv, const char *sep)

## Detailed Description

Argument Manipulation API.

## Function Documentation

## ◆ argiAdd()

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

## ◆ argiCount()

int argiCount | ( | ARGI_const_t | argi | ) |

Return no. of elements in argi array.

Parameters

  argi | argi array

Returns
  no. of elements

## ◆ argiData()

ARGint_t argiData | ( | ARGI_const_t | argi | ) |

Return data from argi array.

Parameters

  argi | argi array

Returns
  argi array data address

## ◆ argiFree()

ARGI_t argiFree | ( | ARGI_t | argi | ) |

Destroy an argi array.

Parameters

  argi | argi array

Returns
  NULL always

## ◆ argvAdd()

int argvAdd | ( | ARGV_t * | argvp,
|  | const char * | val
| ) |  |

Add a string to an argv array.

Return values

  *argvp | argv array

Parameters

  val | string arg to append

Returns
  0 always

## ◆ argvAddNum()

int argvAddNum | ( | ARGV_t * | argvp,
|  | int | val
| ) |  |

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

Return values

  *argvp | argv array

Parameters

  val | numeric arg to append

Returns
  0 always

## ◆ argvAppend()

int argvAppend | ( | ARGV_t * | argvp,
|  | ARGV_const_t | av
| ) |  |

Append one argv array to another.

Return values

  *argvp | argv array

Parameters

  av | argv array to append

Returns
  0 always

## ◆ argvCmp()

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

## ◆ argvCount()

int argvCount | ( | ARGV_const_t | argv | ) |

Return no. of elements in argv array.

Parameters

  argv | argv array

Returns
  no. of elements

## ◆ argvData()

ARGV_t argvData | ( | ARGV_t | argv | ) |

Return data from argv array.

Parameters

  argv | argv array

Returns
  argv array data address

## ◆ argvFree()

ARGV_t argvFree | ( | ARGV_t | argv | ) |

Destroy an argv array.

Parameters

  argv | argv array

Returns
  NULL always

## ◆ argvJoin()

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

Join an argv array into a string.

Parameters

  *argv | argv array to join
  sep | separator string to use

Returns
  malloc'ed string

## ◆ argvNew()

ARGV_t argvNew | ( | void |  | ) |

Create an empty argv array.

Returns
  pointer to empty argv

## ◆ argvPrint()

void argvPrint | ( | const char * | msg,
|  | ARGV_const_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)

## ◆ argvSearch()

ARGV_t argvSearch | ( | ARGV_const_t | argv,
|  | const char * | 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)

## ◆ argvSort()

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

## ◆ argvSplit()

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 | separator characters

Returns
  0 always

## ◆ argvSplitString()

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

Split a string into an argv array.

Parameters

  str | string arg to split
  seps | separator characters
  flags | flags to control behavior

Returns
  argv array