diff options
author | David Bremner <bremner@debian.org> | 2011-10-21 09:19:17 -0300 |
---|---|---|
committer | David Bremner <bremner@debian.org> | 2011-10-22 19:42:54 -0300 |
commit | 61f0a5b8ee2adf540106a09c5f83fe634da6beb3 (patch) | |
tree | 07ca532a91a0fb47b3079ec3937ff1a18ad3cd79 /notmuch-search.c | |
parent | 8bb5b6201ec2cb890655fee6ef7e540f401a4c7e (diff) |
cli: change argument parsing convention for subcommands
previously we deleted the subcommand name from argv before passing to
the subcommand. In this version, the deletion is done in the actual
subcommands. Although this causes some duplication of code, it allows
us to be more flexible about how we parse command line arguments in
the subcommand, including possibly using off-the-shelf routines like
getopt_long that expect the name of the command in argv[0].
Diffstat (limited to 'notmuch-search.c')
-rw-r--r-- | notmuch-search.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/notmuch-search.c b/notmuch-search.c index faccaf7d..6f04d9a4 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -395,6 +395,8 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) int i, ret; output_t output = OUTPUT_SUMMARY; + argc--; argv++; /* skip subcommand argument */ + for (i = 0; i < argc && argv[i][0] == '-'; i++) { if (strcmp (argv[i], "--") == 0) { i++; |