CLEANUP: cli: replace all occurrences of manual handling of return messages
There were 221 places where a status message or an error message were built
to be returned on the CLI. All of them were replaced to use cli_err(),
cli_msg(), cli_dynerr() or cli_dynmsg() depending on what was expected.
This removed a lot of duplicated code because most of the times, 4 lines
are replaced by a single, safer one.
diff --git a/src/peers.c b/src/peers.c
index cb6998c..4695b5e 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -3015,12 +3015,8 @@
}
}
- if (!p) {
- appctx->ctx.cli.severity = LOG_ERR;
- appctx->ctx.cli.msg = "No such peers\n";
- appctx->st0 = CLI_ST_PRINT;
- return 1;
- }
+ if (!p)
+ return cli_err(appctx, "No such peers\n");
}
return 0;