diff options
author | Alex Richardson <alexrichardson@google.com> | 2023-04-28 12:28:06 -0700 |
---|---|---|
committer | Bill McSpadden <bill@riscv.org> | 2023-08-28 09:33:39 -0500 |
commit | 34a32a2d7f0fb5aa826573e42052342a59d6f2fa (patch) | |
tree | 73d242a877bb6675be92592f3b0721e0499da454 /c_emulator/riscv_sim.c | |
parent | 5725f3fe08a2c1b8588b9a4416d91c297e1e5c00 (diff) | |
download | sail-riscv-34a32a2d7f0fb5aa826573e42052342a59d6f2fa.zip sail-riscv-34a32a2d7f0fb5aa826573e42052342a59d6f2fa.tar.gz sail-riscv-34a32a2d7f0fb5aa826573e42052342a59d6f2fa.tar.bz2 |
Fix --help output for options without a short flag
Previously --help printed the following:
```
-V --no-trace
-� --trace-output
-l --inst-limit
```
With the new change it is:
```
-V --no-trace
--trace-output
-l --inst-limit
```
Diffstat (limited to 'c_emulator/riscv_sim.c')
-rw-r--r-- | c_emulator/riscv_sim.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/c_emulator/riscv_sim.c b/c_emulator/riscv_sim.c index 5a73896..84ee04d 100644 --- a/c_emulator/riscv_sim.c +++ b/c_emulator/riscv_sim.c @@ -1,3 +1,4 @@ +#include <ctype.h> #include <getopt.h> #include <stdio.h> #include <stdlib.h> @@ -156,7 +157,10 @@ static void print_usage(const char *argv0, int ec) #endif struct option *opt = options; while (opt->name) { - fprintf(stdout, "\t -%c\t --%s\n", (char)opt->val, opt->name); + if (isprint(opt->val)) + fprintf(stdout, "\t -%c\t --%s\n", (char)opt->val, opt->name); + else + fprintf(stdout, "\t \t --%s\n", opt->name); opt++; } exit(ec); |