+/* Handler for "show defaults" command. */
+static int cli_io_handler_show_defaults(struct appctx *appctx)
+{
+ struct show_be_ctx *ctx = applet_reserve_svcctx(appctx, sizeof(*ctx));
+
+ if (!ctx->px) {
+ /* No need to use ctx <px_watch> as defaults proxies cannot be removed at runtime. */
+ ctx->px = !LIST_ISEMPTY(&defaults_list) ?
+ LIST_ELEM(defaults_list.n, struct proxy *, el) : NULL;
+ }
+
+ while (ctx->px) {
+ chunk_reset(&trash);
+ chunk_appendf(&trash, "%s\n", ctx->px->id);
+
+ if (STRESS_RUN1(applet_putchk_stress(appctx, &trash) == -1,
+ applet_putchk(appctx, &trash) == -1)) {
+ return 0;
+ }
+
+ if (ctx->px->el.n == &defaults_list)
+ break;
+ ctx->px = LIST_ELEM(ctx->px->el.n, struct proxy *, el);
+ }
+
+ return 1;
+}
+