14 typedef char ** ARGV_t;
15 typedef char * const *ARGV_const_t;
17 typedef int * ARGint_t;
22 typedef struct ARGI_s * ARGI_t;
23 typedef struct ARGI_s const * const ARGI_const_t;
26 * Print argv array elements.
27 * @param msg output message prefix (or NULL)
28 * @param argv argv array
29 * @param fp output file handle (NULL uses stderr)
31 void argvPrint(const char * msg, ARGV_const_t argv, FILE * fp);
34 * Destroy an argi array.
35 * @param argi argi array
38 ARGI_t argiFree(ARGI_t argi);
42 * Create an empty argv array.
43 * @return pointer to empty argv
48 * Destroy an argv array.
49 * @param argv argv array
52 ARGV_t argvFree(ARGV_t argv);
55 * Return no. of elements in argi array.
56 * @param argi argi array
57 * @return no. of elements
59 int argiCount(ARGI_const_t argi);
62 * Return data from argi array.
63 * @param argi argi array
64 * @return argi array data address
66 ARGint_t argiData(ARGI_const_t argi);
69 * Return no. of elements in argv array.
70 * @param argv argv array
71 * @return no. of elements
73 int argvCount(ARGV_const_t argv);
76 * Return data from argv array.
77 * @param argv argv array
78 * @return argv array data address
80 ARGV_t argvData(ARGV_t argv);
83 * Compare argv arrays (qsort/bsearch).
84 * @param a 1st instance address
85 * @param b 2nd instance address
86 * @return result of comparison
88 int argvCmp(const void * a, const void * b);
92 * @param argv argv array
93 * @param compar strcmp-like comparison function, or NULL for argvCmp()
96 int argvSort(ARGV_t argv, int (*compar)(const void *, const void *));
99 * Find an element in an argv array.
100 * @param argv argv array
101 * @param val string to find
102 * @param compar strcmp-like comparison function, or NULL for argvCmp()
103 * @return found string (NULL on failure)
105 ARGV_t argvSearch(ARGV_const_t argv, const char *val,
106 int (*compar)(const void *, const void *));
109 * Add an int to an argi array.
110 * @retval *argip argi array
111 * @param ix argi array index (or -1 to append)
112 * @param val int arg to add
115 int argiAdd(ARGI_t * argip, int ix, int val);
118 * Add a string to an argv array.
119 * @retval *argvp argv array
120 * @param val string arg to append
123 int argvAdd(ARGV_t * argvp, const char *val);
126 * Add a number to an argv array (converting to a string).
127 * @retval *argvp argv array
128 * @param val numeric arg to append
131 int argvAddNum(ARGV_t * argvp, int val);
134 * Append one argv array to another.
135 * @retval *argvp argv array
136 * @param av argv array to append
139 int argvAppend(ARGV_t * argvp, ARGV_const_t av);
142 * Split a string into an argv array.
143 * @retval *argvp argv array
144 * @param str string arg to split
145 * @param seps seperator characters
148 int argvSplit(ARGV_t * argvp, const char * str, const char * seps);
154 #endif /* _H_ARGV_ */