rpm  4.12.0.1
argv.h
Go to the documentation of this file.
1 #ifndef _H_ARGV_
2 #define _H_ARGV_
3 
8 #include <stdio.h>
9 #include <rpm/rpmtypes.h>
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 typedef char ** ARGV_t;
16 typedef char * const *ARGV_const_t;
17 
18 typedef int * ARGint_t;
19 struct ARGI_s {
20  unsigned nvals;
21  ARGint_t vals;
22 };
23 typedef struct ARGI_s * ARGI_t;
24 typedef struct ARGI_s const * const ARGI_const_t;
25 
32 void argvPrint(const char * msg, ARGV_const_t argv, FILE * fp);
33 
39 ARGI_t argiFree(ARGI_t argi);
40 
41 
46 ARGV_t argvNew(void);
47 
53 ARGV_t argvFree(ARGV_t argv);
54 
60 int argiCount(ARGI_const_t argi);
61 
67 ARGint_t argiData(ARGI_const_t argi);
68 
74 int argvCount(ARGV_const_t argv);
75 
81 ARGV_t argvData(ARGV_t argv);
82 
89 int argvCmp(const void * a, const void * b);
90 
97 int argvSort(ARGV_t argv, int (*compar)(const void *, const void *));
98 
106 ARGV_t argvSearch(ARGV_const_t argv, const char *val,
107  int (*compar)(const void *, const void *));
108 
116 int argiAdd(ARGI_t * argip, int ix, int val);
117 
124 int argvAdd(ARGV_t * argvp, const char *val);
125 
132 int argvAddNum(ARGV_t * argvp, int val);
133 
140 int argvAppend(ARGV_t * argvp, ARGV_const_t av);
141 
144  ARGV_SKIPEMPTY = (1 << 0), /* omit empty strings from result */
145 };
146 
148 
156 ARGV_t argvSplitString(const char * str, const char * seps, argvFlags flags);
157 
165 int argvSplit(ARGV_t * argvp, const char * str, const char * seps);
166 
173 char *argvJoin(ARGV_const_t argv, const char *sep);
174 
175 #ifdef __cplusplus
176 }
177 #endif
178 
179 #endif /* _H_ARGV_ */
char ** ARGV_t
Definition: argv.h:15
ARGI_t argiFree(ARGI_t argi)
Destroy an argi array.
ARGint_t vals
Definition: argv.h:21
argvFlags_e
Definition: argv.h:142
unsigned nvals
Definition: argv.h:20
int argvSort(ARGV_t argv, int(*compar)(const void *, const void *))
Sort an argv array.
int argvCount(ARGV_const_t argv)
Return no.
struct ARGI_s * ARGI_t
Definition: argv.h:23
struct ARGI_s const *const ARGI_const_t
Definition: argv.h:24
int * ARGint_t
Definition: argv.h:18
ARGV_t argvFree(ARGV_t argv)
Destroy an argv array.
int argvAdd(ARGV_t *argvp, const char *val)
Add a string to an argv array.
uint32_t rpmFlags
Definition: rpmtypes.h:42
int argvCmp(const void *a, const void *b)
Compare argv arrays (qsort/bsearch).
ARGV_t argvNew(void)
Create an empty argv array.
int argvAddNum(ARGV_t *argvp, int val)
Add a number to an argv array (converting to a string).
ARGV_t argvSplitString(const char *str, const char *seps, argvFlags flags)
Split a string into an argv array.
ARGint_t argiData(ARGI_const_t argi)
Return data from argi array.
char *const * ARGV_const_t
Definition: argv.h:16
int argiCount(ARGI_const_t argi)
Return no.
int argiAdd(ARGI_t *argip, int ix, int val)
Add an int to an argi array.
ARGV_t argvData(ARGV_t argv)
Return data from argv array.
ARGV_t argvSearch(ARGV_const_t argv, const char *val, int(*compar)(const void *, const void *))
Find an element in an argv array.
int argvAppend(ARGV_t *argvp, ARGV_const_t av)
Append one argv array to another.
void argvPrint(const char *msg, ARGV_const_t argv, FILE *fp)
Print argv array elements.
int argvSplit(ARGV_t *argvp, const char *str, const char *seps)
Split a string into an argv array.
Definition: argv.h:19
rpmFlags argvFlags
Definition: argv.h:147
char * argvJoin(ARGV_const_t argv, const char *sep)
Join an argv array into a string.