summaryrefslogtreecommitdiff
path: root/src/wasm-option-parser.c
diff options
context:
space:
mode:
authorBen Smith <binji@chromium.org>2016-04-15 01:57:15 -0700
committerBen Smith <binji@chromium.org>2016-04-15 02:15:31 -0700
commit318057e29ad7de266fd6fd17d9706ef172fd25d7 (patch)
treea08531bda3e9bf44671e426df86aee6f05ff35f5 /src/wasm-option-parser.c
parent30a62b7348a529e79008b6bf4bd72783dcd10d7b (diff)
downloadwabt-318057e29ad7de266fd6fd17d9706ef172fd25d7.tar.gz
wabt-318057e29ad7de266fd6fd17d9706ef172fd25d7.tar.bz2
wabt-318057e29ad7de266fd6fd17d9706ef172fd25d7.zip
add help text, w/ tests
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;