diff options
author | Jiri Kosina <jkosina@suse.com> | 2024-11-18 21:29:33 +0100 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.com> | 2024-11-18 21:29:33 +0100 |
commit | f33e46a0c6bddd341d0989484a2546bba7ac4a3c (patch) | |
tree | 4918985ab00890205c8d77d0553472e12e01cd55 /tools/lib/subcmd/parse-options.c | |
parent | 66ef47faa90d838cda131fe1f7776456cc3b59f2 (diff) | |
parent | a025b0dbd83f85cf81ff447431cfd8b2d3cacb0a (diff) |
Merge branch 'for-6.13/wacom' into for-linus
- Sanitization of BTN_TOOL_RUBBER handling (Jason Gerecke)
Diffstat (limited to 'tools/lib/subcmd/parse-options.c')
-rw-r--r-- | tools/lib/subcmd/parse-options.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/tools/lib/subcmd/parse-options.c b/tools/lib/subcmd/parse-options.c index 4b60ec03b0bb..eb896d30545b 100644 --- a/tools/lib/subcmd/parse-options.c +++ b/tools/lib/subcmd/parse-options.c @@ -633,10 +633,11 @@ int parse_options_subcommand(int argc, const char **argv, const struct option *o const char *const subcommands[], const char *usagestr[], int flags) { struct parse_opt_ctx_t ctx; - char *buf = NULL; /* build usage string if it's not provided */ if (subcommands && !usagestr[0]) { + char *buf = NULL; + astrcatf(&buf, "%s %s [<options>] {", subcmd_config.exec_name, argv[0]); for (int i = 0; subcommands[i]; i++) { @@ -678,10 +679,7 @@ int parse_options_subcommand(int argc, const char **argv, const struct option *o astrcatf(&error_buf, "unknown switch `%c'", *ctx.opt); usage_with_options(usagestr, options); } - if (buf) { - usagestr[0] = NULL; - free(buf); - } + return parse_options_end(&ctx); } |