mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
MINOR: filters: extend flt_dump_kws() to dump to stdout
When passing a NULL output buffer the function will now dump to stdout with a more compact format that is more suitable for machine processing. An entry was added to dump_registered_keyword() to call it when the keyword class "flt" is requested.
This commit is contained in:
parent
ca1acd6080
commit
3b65e14842
@ -130,6 +130,7 @@ flt_find_kw(const char *kw)
|
|||||||
/*
|
/*
|
||||||
* Dumps all registered "filter" keywords to the <out> string pointer. The
|
* Dumps all registered "filter" keywords to the <out> string pointer. The
|
||||||
* unsupported keywords are only dumped if their supported form was not found.
|
* unsupported keywords are only dumped if their supported form was not found.
|
||||||
|
* If <out> is NULL, the output is emitted using a more compact format on stdout.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
flt_dump_kws(char **out)
|
flt_dump_kws(char **out)
|
||||||
@ -137,18 +138,20 @@ flt_dump_kws(char **out)
|
|||||||
struct flt_kw_list *kwl;
|
struct flt_kw_list *kwl;
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
if (!out)
|
if (out)
|
||||||
return;
|
|
||||||
|
|
||||||
*out = NULL;
|
*out = NULL;
|
||||||
list_for_each_entry(kwl, &flt_keywords.list, list) {
|
list_for_each_entry(kwl, &flt_keywords.list, list) {
|
||||||
for (index = 0; kwl->kw[index].kw != NULL; index++) {
|
for (index = 0; kwl->kw[index].kw != NULL; index++) {
|
||||||
if (kwl->kw[index].parse ||
|
if (kwl->kw[index].parse ||
|
||||||
flt_find_kw(kwl->kw[index].kw) == &kwl->kw[index]) {
|
flt_find_kw(kwl->kw[index].kw) == &kwl->kw[index]) {
|
||||||
|
if (out)
|
||||||
memprintf(out, "%s[%4s] %s%s\n", *out ? *out : "",
|
memprintf(out, "%s[%4s] %s%s\n", *out ? *out : "",
|
||||||
kwl->scope,
|
kwl->scope,
|
||||||
kwl->kw[index].kw,
|
kwl->kw[index].kw,
|
||||||
kwl->kw[index].parse ? "" : " (not supported)");
|
kwl->kw[index].parse ? "" : " (not supported)");
|
||||||
|
else
|
||||||
|
printf("%s [%s]\n",
|
||||||
|
kwl->kw[index].kw, kwl->scope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1826,6 +1826,7 @@ static void dump_registered_keywords(void)
|
|||||||
printf("# List of supported keyword classes:\n");
|
printf("# List of supported keyword classes:\n");
|
||||||
printf("all: list all keywords\n");
|
printf("all: list all keywords\n");
|
||||||
printf("cfg: configuration keywords\n");
|
printf("cfg: configuration keywords\n");
|
||||||
|
printf("flt: filter names\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (strcmp(kwd_dump, "all") == 0) {
|
else if (strcmp(kwd_dump, "all") == 0) {
|
||||||
@ -1836,6 +1837,11 @@ static void dump_registered_keywords(void)
|
|||||||
printf("# List of registered configuration keywords:\n");
|
printf("# List of registered configuration keywords:\n");
|
||||||
cfg_dump_registered_keywords();
|
cfg_dump_registered_keywords();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (all || strcmp(kwd_dump, "flt") == 0) {
|
||||||
|
printf("# List of registered filter names:\n");
|
||||||
|
flt_dump_kws(NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user