From d7928e2e79e8ffc0e2c2ef0521b6ddda5fee860c Mon Sep 17 00:00:00 2001 From: Denis 'GNUtoo' Carikli Date: Tue, 8 Feb 2022 15:36:06 +0100 Subject: tools: ipc-modem: group contiguous printf calls There is no use in making multiple calls to printf when only one call is sufficient. It's also a good practice to do that in general, especially when part of the code can print to the console at any time, to ensure that that all the buffer is printed contiguously and not interleaved with other prints. Signed-off-by: Denis 'GNUtoo' Carikli --- tools/ipc-modem.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tools/ipc-modem.c b/tools/ipc-modem.c index ae410e6..31fd54e 100644 --- a/tools/ipc-modem.c +++ b/tools/ipc-modem.c @@ -476,19 +476,19 @@ int modem_stop(struct ipc_client *client) void print_help(void) { - printf("usage: ipc-modem \n"); - printf("commands:\n"); - printf("\tboot boot modem only\n"); - printf("\tpower-on power on the modem only\n"); - printf("\tpower-off power off the modem only\n"); - printf("\tstart boot modem and start read loop\n"); - printf("arguments:\n"); - printf("\t--call=[NUMBER] call NUMBER\n"); - printf("\t--debug enable debug messages\n"); - printf("\t--dry-run " - "Test the ipc-modem program without talking to the modem.\n"); - printf("\t--help print this help message\n"); - printf("\t--pin=[PIN] provide SIM card PIN\n"); + printf("usage: ipc-modem \n" + "commands:\n" + "\tboot boot modem only\n" + "\tpower-on power on the modem only\n" + "\tpower-off power off the modem only\n" + "\tstart boot modem and start read loop\n" + "arguments:\n" + "\t--call=[NUMBER] call NUMBER\n" + "\t--debug enable debug messages\n" + "\t--dry-run " + "Test the ipc-modem program without talking to the modem.\n" + "\t--help print this help message\n" + "\t--pin=[PIN] provide SIM card PIN\n"); } int handle_command(struct cmdline_opts *cmdline_opts) @@ -673,10 +673,10 @@ int main(int argc, char *argv[]) } if (cmdline_opts.command == CMD_NONE) { - printf("\n"); - printf("Error: No command given. You need to use a command.\n"); - printf(" See the help below for more details.\n"); - printf("\n"); + printf("\n" + "Error: No command given. You need to use a command.\n" + " See the help below for more details.\n" + "\n"); print_help(); return 1; } -- cgit v1.2.3