Welcome! Log In Create A New Profile

Advanced

[PATCH] BUG/MINOR: cli: don't stop cli_gen_usage_msg() when kw->usage == NULL

Posted by William Lallemand 
In commit abbf607 ("MEDIUM: cli: Add payload support") some cli keywords
without usage message have been added at the beginning of the keywords
array.

cli_gen_usage_usage_msg() use the kw->usage == NULL to stop generating
the usage message for the current keywords array. With those keywords at
the beginning, the whole array in cli.c was ignored in the usage message
generation.

This patch now checks the keyword itself, allowing a keyword without
usage message anywhere in the array.
---
src/cli.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/cli.c b/src/cli.c
index 38d715f83..4adf68401 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -109,8 +109,9 @@ static char *cli_gen_usage_msg(struct appctx *appctx)
chunk_strcat(tmp, stats_sock_usage_msg);
list_for_each_entry(kw_list, &cli_keywords.list, list) {
kw = &kw_list->kw[0];
- while (kw->usage) {
- chunk_appendf(tmp, " %s\n", kw->usage);
+ while (kw->str_kw[0]) {
+ if (kw->usage)
+ chunk_appendf(tmp, " %s\n", kw->usage);
kw++;
}
}
--
2.16.1
On Tue, May 15, 2018 at 11:50:04AM +0200, William Lallemand wrote:
> In commit abbf607 ("MEDIUM: cli: Add payload support") some cli keywords
> without usage message have been added at the beginning of the keywords
> array.
(...)

Applied, thank you William.

Willy
Sorry, only registered users may post in this forum.

Click here to login