rpm: argv.h Source File

rpm 4.13.0

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
142 enum argvFlags_e {
143 ARGV_NONE = 0,
144 ARGV_SKIPEMPTY = (1 << 0), /* omit empty strings from result */
145 };
146
147 typedef rpmFlags argvFlags;
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_ */
ARGV_t
char ** ARGV_t
Definition: argv.h:15
argiFree
ARGI_t argiFree(ARGI_t argi)
Destroy an argi array.
ARGI_s::vals
ARGint_t vals
Definition: argv.h:21
argvFlags_e
argvFlags_e
Definition: argv.h:142
ARGI_s::nvals
unsigned nvals
Definition: argv.h:20
argvSort
int argvSort(ARGV_t argv, int(*compar)(const void *, const void *))
Sort an argv array.
argvCount
int argvCount(ARGV_const_t argv)
Return no.
ARGI_t
struct ARGI_s * ARGI_t
Definition: argv.h:23
ARGI_const_t
struct ARGI_s const *const ARGI_const_t
Definition: argv.h:24
ARGint_t
int * ARGint_t
Definition: argv.h:18
argvFree
ARGV_t argvFree(ARGV_t argv)
Destroy an argv array.
argvAdd
int argvAdd(ARGV_t *argvp, const char *val)
Add a string to an argv array.
rpmFlags
uint32_t rpmFlags
Definition: rpmtypes.h:42
argvCmp
int argvCmp(const void *a, const void *b)
Compare argv arrays (qsort/bsearch).
argvNew
ARGV_t argvNew(void)
Create an empty argv array.
argvAddNum
int argvAddNum(ARGV_t *argvp, int val)
Add a number to an argv array (converting to a string).
argvSplitString
ARGV_t argvSplitString(const char *str, const char *seps, argvFlags flags)
Split a string into an argv array.
ARGV_NONE
Definition: argv.h:143
argiData
ARGint_t argiData(ARGI_const_t argi)
Return data from argi array.
ARGV_const_t
char *const * ARGV_const_t
Definition: argv.h:16
argiCount
int argiCount(ARGI_const_t argi)
Return no.
argiAdd
int argiAdd(ARGI_t *argip, int ix, int val)
Add an int to an argi array.
argvData
ARGV_t argvData(ARGV_t argv)
Return data from argv array.
argvSearch
ARGV_t argvSearch(ARGV_const_t argv, const char *val, int(*compar)(const void *, const void *))
Find an element in an argv array.
argvAppend
int argvAppend(ARGV_t *argvp, ARGV_const_t av)
Append one argv array to another.
argvPrint
void argvPrint(const char *msg, ARGV_const_t argv, FILE *fp)
Print argv array elements.
argvSplit
int argvSplit(ARGV_t *argvp, const char *str, const char *seps)
Split a string into an argv array.
ARGI_s
Definition: argv.h:19
argvFlags
rpmFlags argvFlags
Definition: argv.h:147
ARGV_SKIPEMPTY
Definition: argv.h:144
argvJoin
char * argvJoin(ARGV_const_t argv, const char *sep)
Join an argv array into a string.