From 32bb5fd3a756e619207b507c1ee647f84823856a Mon Sep 17 00:00:00 2001 From: burneykb <burneykb@iastate.edu> Date: Sun, 26 Mar 2017 08:26:50 -0500 Subject: [PATCH] optional string usage for CLI is possible on all commands --- groundStation/src/cli/cli_source.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/groundStation/src/cli/cli_source.c b/groundStation/src/cli/cli_source.c index 214174224..c82443118 100644 --- a/groundStation/src/cli/cli_source.c +++ b/groundStation/src/cli/cli_source.c @@ -39,6 +39,7 @@ int cli_getsource(struct backend_conn * conn, int argc, char ** argv) { int cli_setsource(struct backend_conn * conn, int argc, char ** argv) { struct frontend_source_data source_data; + struct convert_data conv_data; int needHelp = 0; if ((needHelp = help_check(argc, argv))) { @@ -53,10 +54,17 @@ int cli_setsource(struct backend_conn * conn, int argc, char ** argv) { return 1; } - source_data.dst_block = atoi(argv[1]); - source_data.dst_input = atoi(argv[2]); - source_data.src_block = atoi(argv[3]); - source_data.src_output = atoi(argv[4]); + if (convert_to_id(conn, argv, &conv_data, INPUT)) { + return 1; + } + source_data.dst_block = conv_data.val_1; + source_data.dst_input = conv_data.val_2; + + if (convert_to_id(conn, argv+2, &conv_data, OUTPUT)) { + return 1; + } + source_data.src_block = conv_data.val_1; + source_data.src_output = conv_data.val_2; if (frontend_setsource(conn, &source_data)) { return 1; -- GitLab