diff options
| author | Jiri Olsa <[email protected]> | 2017-01-03 08:19:54 +0000 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <[email protected]> | 2017-01-03 14:10:38 +0000 |
| commit | b66fb1da5a8cac3f5c3cdbe41937c91efc4e76a4 (patch) | |
| tree | 66f45f717f76deb0e564013c68772f948037fe88 /tools/lib/subcmd/parse-options.c | |
| parent | perf probe: Fix to get correct modname from elf header (diff) | |
| download | kernel-b66fb1da5a8cac3f5c3cdbe41937c91efc4e76a4.tar.gz kernel-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 <[email protected]>
Tested-by: Wang Nan <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Josh Poimboeuf <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
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; |
