X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=command-line-arguments.c;h=dc517b06ff6090c2290c5e85b6355e3c46f53978;hp=a489612fe197460073f00220733125530d848983;hb=1fdc08d0ffab;hpb=de9baa29dc990e4166b47dc2b0d0cf560014834b 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);