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 --- hicn-light/src/hicn/config/controlMapMe.c | 33 ++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'hicn-light/src/hicn/config/controlMapMe.c') diff --git a/hicn-light/src/hicn/config/controlMapMe.c b/hicn-light/src/hicn/config/controlMapMe.c index a4901db17..b292ee0f0 100644 --- a/hicn-light/src/hicn/config/controlMapMe.c +++ b/hicn-light/src/hicn/config/controlMapMe.c @@ -31,9 +31,15 @@ static void _controlMapMe_Init(CommandParser *parser, CommandOps *ops); static CommandReturn _controlMapMe_Execute(CommandParser *parser, - CommandOps *ops, PARCList *args); + CommandOps *ops, + PARCList *args, + char *output, + size_t output_size); static CommandReturn _controlMapMe_HelpExecute(CommandParser *parser, - CommandOps *ops, PARCList *args); + CommandOps *ops, + PARCList *args, + char *output, + size_t output_size); static const char *_commandMapMe = "mapme"; static const char *_commandMapMeHelp = "help mapme"; @@ -52,18 +58,20 @@ CommandOps *controlMapMe_HelpCreate(ControlState *state) { static CommandReturn _controlMapMe_HelpExecute(CommandParser *parser, CommandOps *ops, - PARCList *args) { + PARCList *args, + char *output, + size_t output_size) { CommandOps *ops_mapme_enable = controlMapMeEnable_HelpCreate(NULL); CommandOps *ops_mapme_discovery = controlMapMeDiscovery_HelpCreate(NULL); CommandOps *ops_mapme_timescale = controlMapMeTimescale_HelpCreate(NULL); CommandOps *ops_mapme_retx = controlMapMeRetx_HelpCreate(NULL); - printf("Available commands:\n"); - printf(" %s\n", ops_mapme_enable->command); - printf(" %s\n", ops_mapme_discovery->command); - printf(" %s\n", ops_mapme_timescale->command); - printf(" %s\n", ops_mapme_retx->command); - printf("\n"); + snprintf(output, output_size, "Available commands:\n" + " %s\n %s\n %s\n %s\n\n", + ops_mapme_enable->command, + ops_mapme_discovery->command, + ops_mapme_timescale->command, + ops_mapme_retx->command); commandOps_Destroy(&ops_mapme_enable); commandOps_Destroy(&ops_mapme_discovery); @@ -86,8 +94,11 @@ static void _controlMapMe_Init(CommandParser *parser, CommandOps *ops) { } static CommandReturn _controlMapMe_Execute(CommandParser *parser, - CommandOps *ops, PARCList *args) { - return _controlMapMe_HelpExecute(parser, ops, args); + CommandOps *ops, + PARCList *args, + char *output, + size_t output_size) { + return _controlMapMe_HelpExecute(parser, ops, args, output, output_size); } // ====================================================================== -- cgit 1.2.3-korg