aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-light/src/hicn/config/controlSet.c
diff options
context:
space:
mode:
authorAngelo Mantellini <angelo.mantellini@cisco.com>2020-06-15 10:02:57 +0000
committerGerrit Code Review <gerrit@fd.io>2020-06-15 10:02:57 +0000
commit961352d7801c4f4bbee2990690b7d5ac5e3c88d6 (patch)
tree20f3915fa8220caec629cfbc1dd918acc359e0e4 /hicn-light/src/hicn/config/controlSet.c
parent0f3841ea94ed9019a538516d774f5936b301e9a0 (diff)
parent9e2c045d6118ef264d6cf8fc655b72d7c4c403dc (diff)
Merge "[HICN-626] Return output from libhicnlight"
Diffstat (limited to 'hicn-light/src/hicn/config/controlSet.c')
-rw-r--r--hicn-light/src/hicn/config/controlSet.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/hicn-light/src/hicn/config/controlSet.c b/hicn-light/src/hicn/config/controlSet.c
index 4f6a17450..37d56e593 100644
--- a/hicn-light/src/hicn/config/controlSet.c
+++ b/hicn-light/src/hicn/config/controlSet.c
@@ -31,10 +31,16 @@
#include <hicn/config/controlSetWldr.h>
static void _controlSet_Init(CommandParser *parser, CommandOps *ops);
-static CommandReturn _controlSet_Execute(CommandParser *parser, CommandOps *ops,
- PARCList *args);
+static CommandReturn _controlSet_Execute(CommandParser *parser,
+ CommandOps *ops,
+ PARCList *args,
+ char *output,
+ size_t output_size);
static CommandReturn _controlSet_HelpExecute(CommandParser *parser,
- CommandOps *ops, PARCList *args);
+ CommandOps *ops,
+ PARCList *args,
+ char *output,
+ size_t output_size);
static const char *_commandSet = "set";
static const char *_commandSetHelp = "help set";
@@ -64,16 +70,18 @@ static void _controlSet_Init(CommandParser *parser, CommandOps *ops) {
}
static CommandReturn _controlSet_HelpExecute(CommandParser *parser,
- CommandOps *ops, PARCList *args) {
+ CommandOps *ops,
+ PARCList *args,
+ char *output,
+ size_t output_size) {
CommandOps *ops_help_set_debug = controlSetDebug_HelpCreate(NULL);
CommandOps *ops_help_set_strategy = controlSetStrategy_HelpCreate(NULL);
CommandOps *ops_help_set_wldr = controlSetWldr_HelpCreate(NULL);
- printf("Available commands:\n");
- printf(" %s\n", ops_help_set_debug->command);
- printf(" %s\n", ops_help_set_strategy->command);
- printf(" %s\n", ops_help_set_wldr->command);
- printf("\n");
+ snprintf(output, output_size, "Available commands:\n %s\n %s\n %s\n\n",
+ ops_help_set_debug->command,
+ ops_help_set_strategy->command,
+ ops_help_set_wldr->command);
commandOps_Destroy(&ops_help_set_debug);
commandOps_Destroy(&ops_help_set_strategy);
@@ -81,7 +89,10 @@ static CommandReturn _controlSet_HelpExecute(CommandParser *parser,
return CommandReturn_Success;
}
-static CommandReturn _controlSet_Execute(CommandParser *parser, CommandOps *ops,
- PARCList *args) {
- return _controlSet_HelpExecute(parser, ops, args);
+static CommandReturn _controlSet_Execute(CommandParser *parser,
+ CommandOps *ops,
+ PARCList *args,
+ char *output,
+ size_t output_size) {
+ return _controlSet_HelpExecute(parser, ops, args, output, output_size);
}