+ if (next != '\0')
+ fprintf (stderr, "Unknown keyword argument \"%s\" for option \"%s\".\n", arg_str, arg_desc->name);
+ else
+ fprintf (stderr, "Option \"%s\" needs a keyword argument.\n", arg_desc->name);
+ return FALSE;
+}
+
+static notmuch_bool_t
+_process_boolean_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {
+
+ if (next == '\0') {
+ *((notmuch_bool_t *)arg_desc->output_var) = TRUE;
+ return TRUE;
+ }
+ if (strcmp (arg_str, "false") == 0) {
+ *((notmuch_bool_t *)arg_desc->output_var) = FALSE;
+ return TRUE;
+ }
+ if (strcmp (arg_str, "true") == 0) {
+ *((notmuch_bool_t *)arg_desc->output_var) = TRUE;
+ return TRUE;
+ }
+ fprintf (stderr, "Unknown argument \"%s\" for (boolean) option \"%s\".\n", arg_str, arg_desc->name);
+ return FALSE;
+}
+
+static notmuch_bool_t
+_process_int_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {
+
+ char *endptr;
+ if (next == '\0' || arg_str[0] == '\0') {
+ fprintf (stderr, "Option \"%s\" needs an integer argument.\n", arg_desc->name);
+ return FALSE;
+ }
+
+ *((int *)arg_desc->output_var) = strtol (arg_str, &endptr, 10);
+ if (*endptr == '\0')
+ return TRUE;
+
+ fprintf (stderr, "Unable to parse argument \"%s\" for option \"%s\" as an integer.\n",
+ arg_str, arg_desc->name);