diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2021-03-27 22:23:50 +0100 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2021-05-29 21:35:06 +0100 |
commit | bfce4b41d15e8983eab49c9fc1aab5fb169c602a (patch) | |
tree | 946c087926076ffc16b02ff6a3f8af981fd3adcb /src/helper/command.c | |
parent | a40cbd85e08df2c87b200c6053c2a608f3bc16e6 (diff) | |
download | riscv-openocd-bfce4b41d15e8983eab49c9fc1aab5fb169c602a.zip riscv-openocd-bfce4b41d15e8983eab49c9fc1aab5fb169c602a.tar.gz riscv-openocd-bfce4b41d15e8983eab49c9fc1aab5fb169c602a.tar.bz2 |
help: fix line size in 'usage' output
The implementation of command 'usage' is broken while checking the
line limit of 76 chars per line (e.g. 'usage load_image') and the
line wrapping is not correct. The same broken code is used for the
first output line of command 'help' too.
When call command_help_show_wrap(), include the command's name in
the string so the whole text would be wrapped.
Change-Id: Idece01ce54994db7e851d8522435ff764b11f3ac
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6223
Tested-by: jenkins
Diffstat (limited to 'src/helper/command.c')
-rw-r--r-- | src/helper/command.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/helper/command.c b/src/helper/command.c index c3d2e95..d4f6a0a 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -820,14 +820,13 @@ static COMMAND_HELPER(command_help_show, struct help_entry *c, ((c->help != NULL) && (strstr(c->help, cmd_match) != NULL)); if (is_match) { - command_help_show_indent(n); - LOG_USER_N("%s", c->cmd_name); - if (c->usage && strlen(c->usage) > 0) { - LOG_USER_N(" "); - command_help_show_wrap(c->usage, 0, n + 5); - } else - LOG_USER_N("\n"); + char *msg = alloc_printf("%s %s", c->cmd_name, c->usage); + command_help_show_wrap(msg, n, n + 5); + free(msg); + } else { + command_help_show_wrap(c->cmd_name, n, n + 5); + } } if (is_match && show_help) { |