Rename CLI_ST_PRINT_FREE to CLI_ST_PRINT_DYNERR.
Most notably, this highlights that this is reserved to error printing.
This is done to ensure consistency between CLI_ST_PRINT/CLI_ST_PRINT_DYN
and CLI_ST_PRINT_ERR/CLI_ST_PRINT_DYNERR. The name is also consistent
with the function cli_dynerr() which activates it.
(void)memprintf(&msg, FLT_OT_CLI_CMD " : current debug level is %hhu", value);
}
- cmn_cli_set_msg(appctx, err, msg, CLI_ST_PRINT_FREE);
+ cmn_cli_set_msg(appctx, err, msg, CLI_ST_PRINT_DYNERR);
FLT_OT_RETURN_INT(retval);
}
(void)memprintf(&msg, "%s%s" FLT_OT_CLI_CMD " : filter %sabled", FLT_OT_CLI_MSG_CAT(msg), value ? "dis" : "en");
} FLT_OT_PROXIES_LIST_END();
- cmn_cli_set_msg(appctx, NULL, msg, CLI_ST_PRINT_FREE);
+ cmn_cli_set_msg(appctx, NULL, msg, CLI_ST_PRINT_DYNERR);
FLT_OT_RETURN_INT(retval);
}
(void)memprintf(&msg, "%s%s" FLT_OT_CLI_CMD " : filter set %s-errors", FLT_OT_CLI_MSG_CAT(msg), value ? "hard" : "soft");
} FLT_OT_PROXIES_LIST_END();
- cmn_cli_set_msg(appctx, NULL, msg, CLI_ST_PRINT_FREE);
+ cmn_cli_set_msg(appctx, NULL, msg, CLI_ST_PRINT_DYNERR);
FLT_OT_RETURN_INT(retval);
}
} FLT_OT_PROXIES_LIST_END();
}
- cmn_cli_set_msg(appctx, err, msg, CLI_ST_PRINT_FREE);
+ cmn_cli_set_msg(appctx, err, msg, CLI_ST_PRINT_DYNERR);
FLT_OT_RETURN_INT(retval);
}
} FLT_OT_PROXIES_LIST_END();
}
- cmn_cli_set_msg(appctx, err, msg, CLI_ST_PRINT_FREE);
+ cmn_cli_set_msg(appctx, err, msg, CLI_ST_PRINT_DYNERR);
FLT_OT_RETURN_INT(retval);
}
nl = "\n";
} FLT_OT_PROXIES_LIST_END();
- cmn_cli_set_msg(appctx, NULL, msg, CLI_ST_PRINT_FREE);
+ cmn_cli_set_msg(appctx, NULL, msg, CLI_ST_PRINT_DYNERR);
FLT_OT_RETURN_INT(retval);
}
CLI_ST_PRINT, /* display const message in cli->msg */
CLI_ST_PRINT_ERR, /* display const error in cli->msg */
CLI_ST_PRINT_DYN, /* display dynamic message in cli->err. After the display, free the pointer */
- CLI_ST_PRINT_FREE, /* display dynamic error in cli->err. After the display, free the pointer */
+ CLI_ST_PRINT_DYNERR, /* display dynamic error in cli->err. After the display, free the pointer */
CLI_ST_CALLBACK, /* custom callback pointer */
};
/* CLI context for printing command responses. */
struct cli_print_ctx {
const char *msg; /* pointer to a persistent message to be returned in CLI_ST_PRINT state */
- char *err; /* pointer to a 'must free' message to be returned in CLI_ST_PRINT_FREE state */
+ char *err; /* pointer to a 'must free' message to be returned in CLI_ST_PRINT_DYN state */
int severity; /* severity of the message to be returned according to (syslog) rfc5424 */
};
struct cli_print_ctx *ctx = applet_reserve_svcctx(appctx, sizeof(*ctx));
ctx->err = err;
- appctx->st0 = CLI_ST_PRINT_FREE;
+ appctx->st0 = CLI_ST_PRINT_DYNERR;
return 1;
}
case CLI_ST_PRINT: /* print const message in msg */
case CLI_ST_PRINT_ERR: /* print const error in msg */
case CLI_ST_PRINT_DYN: /* print dyn message in msg, free */
- case CLI_ST_PRINT_FREE: /* print dyn error in err, free */
+ case CLI_ST_PRINT_DYNERR: /* print dyn error in err, free */
/* the message is in the svcctx */
ctx = applet_reserve_svcctx(appctx, sizeof(*ctx));
if (appctx->st0 == CLI_ST_PRINT || appctx->st0 == CLI_ST_PRINT_ERR) {
LOG_ERR : ctx->severity;
msg = ctx->msg;
}
- else if (appctx->st0 == CLI_ST_PRINT_DYN || appctx->st0 == CLI_ST_PRINT_FREE) {
- sev = appctx->st0 == CLI_ST_PRINT_FREE ?
+ else if (appctx->st0 == CLI_ST_PRINT_DYN || appctx->st0 == CLI_ST_PRINT_DYNERR) {
+ sev = appctx->st0 == CLI_ST_PRINT_DYNERR ?
LOG_ERR : ctx->severity;
msg = ctx->err;
if (!msg) {
}
if (cli_output_msg(res, msg, sev, cli_get_severity_output(appctx)) != -1) {
- if (appctx->st0 == CLI_ST_PRINT_FREE ||
- appctx->st0 == CLI_ST_PRINT_DYN) {
+ if (appctx->st0 == CLI_ST_PRINT_DYN ||
+ appctx->st0 == CLI_ST_PRINT_DYNERR) {
ha_free(&ctx->err);
}
appctx->st0 = CLI_ST_PROMPT;
appctx->io_release(appctx);
appctx->io_release = NULL;
}
- else if (appctx->st0 == CLI_ST_PRINT_FREE || appctx->st0 == CLI_ST_PRINT_DYN) {
+ else if (appctx->st0 == CLI_ST_PRINT_DYN || appctx->st0 == CLI_ST_PRINT_DYNERR) {
struct cli_print_ctx *ctx = applet_reserve_svcctx(appctx, sizeof(*ctx));
ha_free(&ctx->err);