+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);
+ return FALSE;
+}
+
+static notmuch_bool_t
+_process_string_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {
+
+ if (next == '\0') {
+ fprintf (stderr, "Option \"%s\" needs a string argument.\n", arg_desc->name);
+ return FALSE;
+ }
+ if (arg_str[0] == '\0') {
+ fprintf (stderr, "String argument for option \"%s\" must be non-empty.\n", arg_desc->name);
+ return FALSE;
+ }
+ *((const char **)arg_desc->output_var) = arg_str;
+ return TRUE;
+}
+