- while (keywords->name) {
- if (strcmp (arg_str, keywords->name) == 0) {
- if (arg_desc->output_var) {
- if (arg_desc->opt_type == NOTMUCH_OPT_KEYWORD_FLAGS)
- *((int *)arg_desc->output_var) |= keywords->value;
- else
- *((int *)arg_desc->output_var) = keywords->value;
- }
- return TRUE;
+ for (keywords = arg_desc->keywords; keywords->name; keywords++) {
+ if (strcmp (arg_str, keywords->name) != 0)
+ continue;
+
+ if (arg_desc->opt_flags && negate)
+ *arg_desc->opt_flags &= ~keywords->value;
+ else if (arg_desc->opt_flags)
+ *arg_desc->opt_flags |= keywords->value;
+ else
+ *arg_desc->opt_keyword = keywords->value;
+
+ return OPT_OK;
+ }
+
+ if (arg_desc->opt_keyword && arg_desc->keyword_no_arg_value && next != ':' && next != '=') {
+ for (keywords = arg_desc->keywords; keywords->name; keywords++) {
+ if (strcmp (arg_desc->keyword_no_arg_value, keywords->name) != 0)
+ continue;
+
+ *arg_desc->opt_keyword = keywords->value;
+ fprintf (stderr, "Warning: No known keyword option given for \"%s\", choosing value \"%s\"."
+ " Please specify the argument explicitly!\n", arg_desc->name, arg_desc->keyword_no_arg_value);
+
+ return OPT_GIVEBACK;