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

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.
This commit is contained in:
William Lallemand 2018-05-15 11:50:04 +02:00 committed by Willy Tarreau
parent c55b88ece6
commit 0154edc96f

View File

@ -109,8 +109,9 @@ static char *cli_gen_usage_msg(struct appctx *appctx)
chunk_strcat(tmp, stats_sock_usage_msg); chunk_strcat(tmp, stats_sock_usage_msg);
list_for_each_entry(kw_list, &cli_keywords.list, list) { list_for_each_entry(kw_list, &cli_keywords.list, list) {
kw = &kw_list->kw[0]; kw = &kw_list->kw[0];
while (kw->usage) { while (kw->str_kw[0]) {
chunk_appendf(tmp, " %s\n", kw->usage); if (kw->usage)
chunk_appendf(tmp, " %s\n", kw->usage);
kw++; kw++;
} }
} }