diff options
author | Jiri Olsa <jolsa@kernel.org> | 2017-01-03 09:19:54 +0100 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-01-03 15:10:38 +0100 |
commit | b66fb1da5a8cac3f5c3cdbe41937c91efc4e76a4 (patch) | |
tree | 66f45f717f76deb0e564013c68772f948037fe88 /tools/lib/subcmd/parse-options.c | |
parent | perf probe: Fix to get correct modname from elf header (diff) | |
download | linux-b66fb1da5a8cac3f5c3cdbe41937c91efc4e76a4.tar.xz linux-b66fb1da5a8cac3f5c3cdbe41937c91efc4e76a4.zip |
tools lib subcmd: Add OPT_STRING_OPTARG_SET option
To allow string options with a default argument and variable set when
the option is used.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Wang Nan <wangnan0@huawei.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1483431600-19887-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib/subcmd/parse-options.c')
-rw-r--r-- | tools/lib/subcmd/parse-options.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/lib/subcmd/parse-options.c b/tools/lib/subcmd/parse-options.c index 3284bb14ae78..8aad81151d50 100644 --- a/tools/lib/subcmd/parse-options.c +++ b/tools/lib/subcmd/parse-options.c @@ -213,6 +213,9 @@ static int get_value(struct parse_opt_ctx_t *p, else err = get_arg(p, opt, flags, (const char **)opt->value); + if (opt->set) + *(bool *)opt->set = true; + /* PARSE_OPT_NOEMPTY: Allow NULL but disallow empty string. */ if (opt->flags & PARSE_OPT_NOEMPTY) { const char *val = *(const char **)opt->value; |