8 const char key = ca->
argv[ca->
idx][1];
11 if (!
str)
gw_err(
_(
"option '-%c' needs arguments\n"), key);
22 const size_t sz = strlen(as->
str);
27 while ((c = as->
str[i]) !=
'\0') {
28 const bool skip = prev ==
'\\';
29 const bool comma = c ==
',';
34 buf[j++] = (prev = c);
ANN Vector split_args(MemPool p, const m_str str)
returns separated arguments from a string in a vector.
ANN m_str option_argument(struct CArg *ca)
returns the option to the argument, errors and returns if none
static ANN void _split_args(MemPool mp, struct ArgSplitter *as)
#define gw_err(...)
similar to fprintf(stderr, fmt, ...)
meta header (use this to include the whole library)
static ANN m_str mstrdup(MemPool mp, const char *name)
mp_alloc version of strdup
#define mp_free2(p, sz, a)
#define mp_malloc2(p, sz)
used internally to split arguments
structure used to parse arguments
char ** argv
array of char* arguments
int idx
curr index [internal]
ANN void vector_add(const Vector v, const vtype data)
Vector new_vector(MemPool p)