diff options
Diffstat (limited to 'Documentation/perf_counter/util/parse-options.c')
-rw-r--r-- | Documentation/perf_counter/util/parse-options.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Documentation/perf_counter/util/parse-options.c b/Documentation/perf_counter/util/parse-options.c index 28b34c1..b80abd9 100644 --- a/Documentation/perf_counter/util/parse-options.c +++ b/Documentation/perf_counter/util/parse-options.c @@ -113,6 +113,22 @@ static int get_value(struct parse_opt_ctx_t *p, return opterror(opt, "expects a numerical value", flags); return 0; + case OPTION_LONG: + if (unset) { + *(long *)opt->value = 0; + return 0; + } + if (opt->flags & PARSE_OPT_OPTARG && !p->opt) { + *(long *)opt->value = opt->defval; + return 0; + } + if (get_arg(p, opt, flags, &arg)) + return -1; + *(long *)opt->value = strtol(arg, (char **)&s, 10); + if (*s) + return opterror(opt, "expects a numerical value", flags); + return 0; + default: die("should not happen, someone must be hit on the forehead"); } |