summaryrefslogtreecommitdiff
path: root/src/wasm-option-parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-option-parser.c')
-rw-r--r--src/wasm-option-parser.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/wasm-option-parser.c b/src/wasm-option-parser.c
index b5cd280b..4d9eeabd 100644
--- a/src/wasm-option-parser.c
+++ b/src/wasm-option-parser.c
@@ -160,10 +160,18 @@ void wasm_parse_options(WasmOptionParser* parser,
}
}
+static const char* trim_argv0(const char* argv0) {
+ char* last_slash = strrchr(argv0, '/');
+ if (last_slash)
+ return last_slash + 1;
+ return argv0;
+}
+
void wasm_print_help(WasmOptionParser* parser) {
int i;
/* TODO(binji): do something more generic for filename here */
- printf("usage: %s [options] filename\n", parser->argv0);
+ printf("usage: %s [options] filename\n\n", trim_argv0(parser->argv0));
+ printf("%s\n", parser->description);
printf("options:\n");
const int extra_space = 8;