mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
MINOR: services: alphabetically sort service names
Note that we cannot reuse dump_act_rules() because the output format may be adjusted depending on the call place (this is also used from haproxy -vv). The principle is the same however.
This commit is contained in:
parent
0f99637353
commit
3f0b2e85f3
18
src/stream.c
18
src/stream.c
@ -3077,21 +3077,31 @@ struct action_kw *service_find(const char *kw)
|
|||||||
*/
|
*/
|
||||||
void list_services(FILE *out)
|
void list_services(FILE *out)
|
||||||
{
|
{
|
||||||
|
const struct action_kw *akwp, *akwn;
|
||||||
struct action_kw_list *kw_list;
|
struct action_kw_list *kw_list;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (out)
|
if (out)
|
||||||
fprintf(out, "Available services :");
|
fprintf(out, "Available services :");
|
||||||
|
|
||||||
|
for (akwn = akwp = NULL;; akwp = akwn) {
|
||||||
list_for_each_entry(kw_list, &service_keywords, list) {
|
list_for_each_entry(kw_list, &service_keywords, list) {
|
||||||
for (i = 0; kw_list->kw[i].kw != NULL; i++) {
|
for (i = 0; kw_list->kw[i].kw != NULL; i++) {
|
||||||
|
if (strordered(akwp ? akwp->kw : NULL,
|
||||||
|
kw_list->kw[i].kw,
|
||||||
|
akwn != akwp ? akwn->kw : NULL))
|
||||||
|
akwn = &kw_list->kw[i];
|
||||||
found = 1;
|
found = 1;
|
||||||
if (out)
|
|
||||||
fprintf(out, " %s", kw_list->kw[i].kw);
|
|
||||||
else
|
|
||||||
printf("%s\n", kw_list->kw[i].kw);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (akwn == akwp)
|
||||||
|
break;
|
||||||
|
if (out)
|
||||||
|
fprintf(out, " %s", akwn->kw);
|
||||||
|
else
|
||||||
|
printf("%s\n", akwn->kw);
|
||||||
|
}
|
||||||
if (!found && out)
|
if (!found && out)
|
||||||
fprintf(out, " none\n");
|
fprintf(out, " none\n");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user