31#define SPECLIST_TAG cmdline_value
32#define SPECLIST_TYPE char
35#define cmdline_value_list_iterate(vallist, pvalue) \
36 TYPED_LIST_ITERATE(char *, vallist, pvalue)
37#define cmdline_value_list_iterate_end LIST_ITERATE_END
51 char **argv,
int *i,
int argc,
63 char *opt = argv[*i] + (argv[*i][1] !=
'-' ? 0 :
len);
72 if (strlen(opt) == 0) {
124 bool in_single_quotes =
FALSE, in_double_quotes =
FALSE;
125 size_t i,
len = strlen(s);
127 for (i = 0; i <
len; i++) {
128 if (s[i] ==
'"' && !in_single_quotes) {
129 in_double_quotes = !in_double_quotes;
130 }
else if (s[i] ==
'\'' && !in_double_quotes) {
131 in_single_quotes = !in_single_quotes;
134 if (in_single_quotes || in_double_quotes) {
138 if (strchr(reject, s[i])) {
167 const char *delimiterset)
173 for (token = 0; token < num_tokens && *
str !=
'\0'; token++) {
174 size_t len, padlength = 0;
177 str += strspn(
str, delimiterset);
183 if ((
str[0] ==
'"' &&
str[
len - 1] ==
'"')
184 || (
str[0] ==
'\'' &&
str[
len - 1] ==
'\'')) {
207 for (i = 0; i < ntokens; i++) {
#define cmdline_value_list_iterate(vallist, pvalue)
static struct cmdline_value_list * cmdline_values
void free_tokens(char **tokens, size_t ntokens)
#define cmdline_value_list_iterate_end
int get_tokens(const char *str, char **tokens, size_t num_tokens, const char *delimiterset)
static size_t fc_strcspn(const char *s, const char *reject)
bool is_option(const char *option_name, char *option)
char * get_option_malloc(const char *option_name, char **argv, int *i, int argc, bool gc)
void cmdline_option_values_free(void)
char * local_to_internal_string_malloc(const char *text)
void fc_fprintf(FILE *stream, const char *format,...) fc__attribute((__format__(__printf__
#define fc_assert_ret_val(condition, val)
const char * option_name(const struct option *poption)
size_t fc_strlcpy(char *dest, const char *src, size_t n)