summaryrefslogtreecommitdiffstats
path: root/command-line-arguments.c
diff options
context:
space:
mode:
Diffstat (limited to 'command-line-arguments.c')
-rw-r--r--command-line-arguments.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/command-line-arguments.c b/command-line-arguments.c
index a489612f..dc517b06 100644
--- a/command-line-arguments.c
+++ b/command-line-arguments.c
@@ -133,6 +133,11 @@ parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_
const char *arg = _arg + 2; /* _arg starts with -- */
const notmuch_opt_desc_t *try;
+
+ const char *next_arg = NULL;
+ if (opt_index < argc - 1 && strncmp (argv[opt_index + 1], "--", 2) != 0)
+ next_arg = argv[opt_index + 1];
+
for (try = options; try->opt_type != NOTMUCH_OPT_END; try++) {
if (try->opt_type == NOTMUCH_OPT_INHERIT) {
int new_index = parse_option (argc, argv, try->output_var, opt_index);
@@ -158,6 +163,12 @@ parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_
if (next != '=' && next != ':' && next != '\0')
continue;
+ if (next == '\0' && next_arg != NULL && try->opt_type != NOTMUCH_OPT_BOOLEAN) {
+ next = ' ';
+ value = next_arg;
+ opt_index ++;
+ }
+
if (try->output_var == NULL)
INTERNAL_ERROR ("output pointer NULL for option %s", try->name);