argv.h File Reference
RPMIO.
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | ARGI_s

## Typedefs

typedef const char * | ARGstr_t
typedef ARGstr_t * | ARGV_t
typedef unsigned int * | ARGint_t
typedef struct ARGI_s * | ARGI_t

## Functions

void | argvPrint (const char *msg, ARGV_t argv, FILE *fp)
| Print argv array elements. More...
ARGI_t | argiFree (ARGI_t argi)
| Destroy an argi array. More...
ARGV_t | argvFree (ARGV_t argv)
| Destroy an argv array. More...
int | argiCount (const ARGI_t argi)
| Return no. More...
ARGint_t | argiData (ARGI_t argi)
| Return data from argi array. More...
int | argvCount (const ARGV_t argv)
| Return no. More...
ARGV_t | argvData (ARGV_t argv)
| Return data from argv array. More...
int | argiCmp (const void *a, const void *b)
| Compare argi elements (qsort/bsearch). More...
int | argvCmp (const void *a, const void *b)
| Compare argv elements using strcmp (qsort/bsearch). More...
int | argvStrcasecmp (const void *a, const void *b)
| Compare argv elements using strcasecmp (qsort/bsearch). More...
int | argiSort (ARGI_t argi, int(*compar)(const void *, const void *))
| Sort an argi array. More...
int | argvSort (ARGV_t argv, int(*compar)(const void *, const void *))
| Sort an argv array. More...
ARGV_t | argvSearch (ARGV_t argv, ARGstr_t 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, ARGstr_t val)
| Add a string to an argv array. More...
int | argvAppend (ARGV_t *argvp, ARGV_t av)
| Append one argv array to another. More...
int | argvSplit (ARGV_t *argvp, const char *str, const char *seps)
| Split a string into an argv array. More...
char * | argvJoin (ARGV_t argv)
| Concatenate an argv array into a string. More...
int | argvFgets (ARGV_t *argvp, void *fd)
| Read lines into an argv array. More...

## Typedef Documentation

typedef struct ARGI_s* ARGI_t

Definition at line 17 of file argv.h.

typedef unsigned int* ARGint_t

Definition at line 11 of file argv.h.

typedef const char* ARGstr_t

Definition at line 8 of file argv.h.

typedef ARGstr_t* ARGV_t

Definition at line 9 of file argv.h.

## Function Documentation

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 170 of file argv.c.

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

Referenced by mtreeArgCallback(), nwlookupTag(), rpmdcParseCoreutils(), rpmdcParseZeroInstall(), rpmfcApply(), rpmfcClassify(), runImmedTriggers(), runTriggersLoop(), set(), and wnlookupTag().

int argiCmp | ( | const void * | a,
|  | const void * | b
| ) |  |

Compare argi elements (qsort/bsearch).

Parameters

  a | 1st instance address
  b | 2nd instance address

Returns
  result of comparison

Definition at line 82 of file argv.c.

Referenced by argiSort().

int argiCount | ( | const ARGI_t | argi | ) |

Return no.

of elements in argi array.

Parameters

  argi | argi array

Returns
  no. of elements

Definition at line 50 of file argv.c.

References ARGI_s::nvals.

Referenced by argiSort(), main(), nwlookupTag(), rpmfcApply(), rpmfcGenerateDepends(), runImmedTriggers(), runTriggersLoop(), and wnlookupTag().

ARGint_t argiData | ( | ARGI_t | argi | ) |

Return data from argi array.

Parameters

  argi | argi array

Returns
  argi array data address

Definition at line 58 of file argv.c.

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

Referenced by argiSort(), nwlookupTag(), rpmfcGenerateDepends(), runImmedTriggers(), runTriggersLoop(), and wnlookupTag().

ARGI_t argiFree | ( | ARGI_t | argi | ) |

Destroy an argi array.

Parameters

  argi | argi array

Returns
  NULL always

Definition at line 29 of file argv.c.

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

Referenced by main(), needswhatTag(), rpmfcFini(), runImmedTriggers(), runTriggersLoop(), and whatneedsTag().

int argiSort | ( | ARGI_t | argi,
|  | int(*)(const void *, const void *) | compar
| ) |  |

Sort an argi array.

Parameters

  argi | argi array
  compar | strcmp-like comparison function, or NULL for argiCmp()

Returns
  0 always

Definition at line 120 of file argv.c.

References argiCmp(), argiCount(), and argiData().

Referenced by runImmedTriggers(), and runTriggersLoop().

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 191 of file argv.c.

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

Referenced by argvFgets(), avContextAdd(), main(), missingokTag(), needswhatTag(), nwlookupTag(), parseFormat(), repoDoPkgMetadata(), repoGetFileList(), rpmcliInstall(), rpmdbMireApply(), rpmdbTriggerGlobs(), rpmdcParseCoreutils(), rpmdcParseZeroInstall(), rpmfcClassify(), rpmfcSaveArg(), rpmfiOpendir(), rpmteChain(), runImmedTriggers(), set(), unsatisfiedDepend(), whatneedsTag(), and wnlookupTag().

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

Append one argv array to another.

Return values

  *argvp | argv array

Parameters

  av | argv array to append (NULL does nothing)

Returns
  0 always

Definition at line 208 of file argv.c.

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

Referenced by main(), rpmcliInstallElementPath(), rpmdbMireApply(), rpmfcExec(), and rpmgiGlobArgv().

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

Compare argv elements using strcmp (qsort/bsearch).

Parameters

  a | 1st instance address
  b | 2nd instance address

Returns
  result of comparison

Definition at line 90 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 66 of file argv.c.

Referenced by argvAdd(), argvAppend(), argvSearch(), argvSort(), findTag(), getMachineInfo(), hSaveBlinks(), hSaveFlinks(), main(), needswhatTag(), packageSources(), repoDoPkgMetadata(), rpmcliInstallElementPath(), rpmdbTriggerGlobs(), rpmfcApply(), rpmfcClassify(), rpmfcExpandAppend(), rpmfcGenerateDepends(), rpmfcHelper(), rpnFormat(), strsubFormat(), and whatneedsTag().

ARGV_t argvData | ( | ARGV_t | argv | ) |

Return data from argv array.

Parameters

  argv | argv array

Returns
  argv array data address

Definition at line 75 of file argv.c.

Referenced by hSaveBlinks(), hSaveFlinks(), and rpmfcGenerateDepends().

int argvFgets | ( | ARGV_t * | argvp,
|  | void * | fd
| ) |  |

Read lines into an argv array.

Return values

  *argvp | argv array

Parameters

  fd | rpmio FD_t (NULL uses stdin)

Returns
  0 on success

Definition at line 291 of file argv.c.

References argvAdd(), argvFree(), and fdGetFILE.

Referenced by main().

ARGV_t argvFree | ( | ARGV_t | argv | ) |

Destroy an argv array.

Parameters

  argv | argv array

Returns
  NULL always

Definition at line 39 of file argv.c.

References _free().

Referenced by argvFgets(), argvSplit(), avContextDestroy(), delTE(), formatValue(), freeFormat(), getMachineInfo(), main(), missingokTag(), needswhatTag(), packageSources(), parsePrep(), processPackageFiles(), processSourceFiles(), repoDoPkgMetadata(), rpmcliInstall(), rpmcliInstallElementPath(), rpmdbMireApply(), rpmdbTriggerGlobs(), rpmdsNew(), rpmfcClassify(), rpmfcExec(), rpmfcFini(), rpmfcGenerateDepends(), rpmfcHelper(), rpmfiNew(), rpmfiOpendir(), rpmgiFini(), rpmgiGlobArgv(), rpmtsFini(), runImmedTriggers(), runTriggers(), skipFiles(), tagClean(), tagLoadATags(), unsatisfiedDepend(), and whatneedsTag().

char* argvJoin | ( | ARGV_t | argv | ) |

Concatenate an argv array into a string.

Parameters

  argv | argv array

Returns
  concatenated string

Definition at line 266 of file argv.c.

References stpcpy(), and xmalloc().

Referenced by getOutputFrom().

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 14 of file argv.c.

Referenced by main(), repoGetFileList(), and rpmtsFini().

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 139 of file argv.c.

References argvCmp(), and argvCount().

Referenced by findPreambleTag(), isPart(), nwlookupTag(), rpmfcClassify(), rpmfcSaveArg(), and wnlookupTag().

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 131 of file argv.c.

References argvCmp(), and argvCount().

Referenced by main(), nwlookupTag(), rpmfcSaveArg(), tagLoadATags(), and wnlookupTag().

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 (NULL is C isspace() chars)

Returns
  0 always

Definition at line 225 of file argv.c.

References _free(), argvFree(), xmalloc(), and xstrdup().

Referenced by _RequestPass(), formatValue(), getMachineInfo(), parsePrep(), processPackageFiles(), processSourceFiles(), rpmcliInstallElementPath(), rpmfcHelper(), skipFiles(), tagLoadATags(), and unsatisfiedDepend().

int argvStrcasecmp | ( | const void * | a,
|  | const void * | b
| ) |  |

Compare argv elements using strcasecmp (qsort/bsearch).

Parameters

  a | 1st instance address
  b | 2nd instance address

Returns
  result of comparison

Definition at line 97 of file argv.c.

References xstrcasecmp().

Referenced by findPreambleTag(), and isPart().