From 9e2c045d6118ef264d6cf8fc655b72d7c4c403dc Mon Sep 17 00:00:00 2001 From: Angelo Mantellini Date: Tue, 9 Jun 2020 14:48:02 +0200 Subject: [HICN-626] Return output from libhicnlight Signed-off-by: Angelo Mantellini Change-Id: I2351ce4dcefa1311fa09049f87e8317c8fe449f4 --- .../src/hicn/config/controlUpdateConnection.c | 37 ++++++++++++++-------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'hicn-light/src/hicn/config/controlUpdateConnection.c') diff --git a/hicn-light/src/hicn/config/controlUpdateConnection.c b/hicn-light/src/hicn/config/controlUpdateConnection.c index ff834522e..70a017d4f 100644 --- a/hicn-light/src/hicn/config/controlUpdateConnection.c +++ b/hicn-light/src/hicn/config/controlUpdateConnection.c @@ -37,10 +37,14 @@ static CommandReturn _controlUpdateConnection_Execute(CommandParser *parser, CommandOps *ops, - PARCList *args); + PARCList *args, + char *output, + size_t output_size); static CommandReturn _controlUpdateConnection_HelpExecute(CommandParser *parser, CommandOps *ops, - PARCList *args); + PARCList *args, + char *output, + size_t output_size); static const char *command_update_connection = "update connection"; static const char *command_help_update_connection = "help update connection"; @@ -62,24 +66,29 @@ static const int _indexTags = 3; static CommandReturn _controlUpdateConnection_HelpExecute(CommandParser *parser, CommandOps *ops, - PARCList *args) { - printf("commands:\n"); - printf(" update connection \n"); - printf("\n"); - printf( - " symbolic: User defined name for connection, must start with " - "alpha and be alphanum\n"); - printf(" id: Identifier for the connection\n"); - printf(" tags: A string representing tags\n"); + PARCList *args, + char *output, + size_t output_size) { + + snprintf(output, output_size, + "commands:\n" + " update connection \n" + "\n" + " symbolic: User defined name for connection, must start with " + "alpha and be alphanum\n" + " id: Identifier for the connection\n" + " tags: A string representing tags\n"); return CommandReturn_Success; } static CommandReturn _controlUpdateConnection_Execute(CommandParser *parser, CommandOps *ops, - PARCList *args) { + PARCList *args, + char *output, + size_t output_size) { if ((parcList_Size(args) != 3) && (parcList_Size(args) != 4)) { - _controlUpdateConnection_HelpExecute(parser, ops, args); + _controlUpdateConnection_HelpExecute(parser, ops, args, output, output_size); return CommandReturn_Failure; } @@ -87,7 +96,7 @@ static CommandReturn _controlUpdateConnection_Execute(CommandParser *parser, if (!utils_ValidateSymbolicName(symbolicOrConnid) && !utils_IsNumber(symbolicOrConnid)) { - printf( + snprintf(output, output_size, "ERROR: Invalid symbolic or connid:\nsymbolic name must begin with an " "alpha followed by alphanum;\nconnid must be an integer\n"); return CommandReturn_Failure; -- cgit 1.2.3-korg