summaryrefslogtreecommitdiffstats
path: root/src/opt.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/opt.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/opt.c b/src/opt.c
index 7a0f346..bd0bc52 100644
--- a/src/opt.c
+++ b/src/opt.c
@@ -240,7 +240,7 @@ static int perf_opt_long_parse(char* optarg)
if ((arg = strchr(optarg, '='))) {
arg++;
- optlen = arg - optarg;
+ optlen = strlen(arg);
if (optlen < 1) {
return -1;
}
@@ -305,7 +305,11 @@ void perf_long_opt_usage(void)
fprintf(stderr, "Usage: %s ... -O <name>[=<value>] ...\n\nAvailable long options:\n", progname);
long_opt_t* opt = longopts;
while (opt) {
- fprintf(stderr, " %s%s: %s", opt->name, opt->type != perf_opt_boolean ? "=<val>" : "", opt->help);
+ if (opt->type == perf_opt_boolean) {
+ fprintf(stderr, " %s: %s", opt->name, opt->help);
+ } else {
+ fprintf(stderr, " %s=<%s>: %s", opt->name, opt->desc ? opt->desc : "val", opt->help);
+ }
if (opt->defval) {
fprintf(stderr, " (default: %s)", opt->defval);
}