2011-09-13 21:57:57 +00:00
|
|
|
#ifndef ARGV_ARRAY_H
|
|
|
|
#define ARGV_ARRAY_H
|
|
|
|
|
2012-04-18 21:08:49 +00:00
|
|
|
extern const char *empty_argv[];
|
2011-09-13 21:57:57 +00:00
|
|
|
|
|
|
|
struct argv_array {
|
|
|
|
const char **argv;
|
|
|
|
int argc;
|
|
|
|
int alloc;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define ARGV_ARRAY_INIT { empty_argv, 0, 0 }
|
|
|
|
|
|
|
|
void argv_array_init(struct argv_array *);
|
2018-05-21 14:54:27 +00:00
|
|
|
const char *argv_array_push(struct argv_array *, const char *);
|
2011-09-13 21:57:57 +00:00
|
|
|
__attribute__((format (printf,2,3)))
|
2018-05-21 14:54:27 +00:00
|
|
|
const char *argv_array_pushf(struct argv_array *, const char *fmt, ...);
|
2013-07-18 20:02:12 +00:00
|
|
|
LAST_ARG_MUST_BE_NULL
|
2012-04-18 21:10:05 +00:00
|
|
|
void argv_array_pushl(struct argv_array *, ...);
|
2015-06-14 08:41:50 +00:00
|
|
|
void argv_array_pushv(struct argv_array *, const char **);
|
2012-09-01 11:25:27 +00:00
|
|
|
void argv_array_pop(struct argv_array *);
|
2018-04-25 09:53:57 +00:00
|
|
|
/* Splits by whitespace; does not handle quoted arguments! */
|
|
|
|
void argv_array_split(struct argv_array *, const char *);
|
2011-09-13 21:57:57 +00:00
|
|
|
void argv_array_clear(struct argv_array *);
|
2016-02-22 22:44:15 +00:00
|
|
|
const char **argv_array_detach(struct argv_array *);
|
2011-09-13 21:57:57 +00:00
|
|
|
|
|
|
|
#endif /* ARGV_ARRAY_H */
|