[Replicant] [libsamsung-ipc] [PATCH 12/14] tools: ipc-modem: move command line options prints in its own function

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Wed Sep 1 14:25:33 UTC 2021


As this is done once all options have been parsed,
it enables to only print some options when debug is on.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
 tools/ipc-modem.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/ipc-modem.c b/tools/ipc-modem.c
index 305499c..c1b071f 100644
--- a/tools/ipc-modem.c
+++ b/tools/ipc-modem.c
@@ -561,6 +561,13 @@ modem_quit:
 	return rc;
 }
 
+void print_cmdline_opts(struct cmdline_opts *cmdline_opts)
+
+{
+	if (cmdline_opts->debug)
+		printf("[I] Debug enabled\n");
+}
+
 int main(int argc, char *argv[])
 {
 	struct cmdline_opts cmdline_opts;
@@ -606,7 +613,6 @@ int main(int argc, char *argv[])
 				}
 			} else if (strcmp(opt_l[opt_i].name, "debug") == 0) {
 				cmdline_opts.debug = true;
-				printf("[I] Debug enabled\n");
 			} else if (strncmp(opt_l[opt_i].name, "help", 4) == 0) {
 				print_help();
 				exit(1);
@@ -659,5 +665,7 @@ int main(int argc, char *argv[])
 		return 1;
 	}
 
+	print_cmdline_opts(&cmdline_opts);
+
 	return handle_command(&cmdline_opts);
 }
-- 
2.33.0



More information about the Replicant mailing list