aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-light/src/hicn/config/controlAdd.c
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-light/src/hicn/config/controlAdd.c')
-rw-r--r--hicn-light/src/hicn/config/controlAdd.c49
1 files changed, 34 insertions, 15 deletions
diff --git a/hicn-light/src/hicn/config/controlAdd.c b/hicn-light/src/hicn/config/controlAdd.c
index e10b56e99..cac8e7913 100644
--- a/hicn-light/src/hicn/config/controlAdd.c
+++ b/hicn-light/src/hicn/config/controlAdd.c
@@ -35,10 +35,18 @@
// ===================================================
static void _controlAdd_Init(CommandParser *parser, CommandOps *ops);
-static CommandReturn _controlAdd_Execute(CommandParser *parser, CommandOps *ops,
- PARCList *args);
+
+static CommandReturn _controlAdd_Execute(CommandParser *parser,
+ CommandOps *ops,
+ PARCList *args,
+ char *output,
+ size_t output_size);
+
static CommandReturn _controlAdd_HelpExecute(CommandParser *parser,
- CommandOps *ops, PARCList *args);
+ CommandOps *ops,
+ PARCList *args,
+ char *output,
+ size_t output_size);
// ===================================================
@@ -58,7 +66,10 @@ CommandOps *controlAdd_CreateHelp(ControlState *state) {
// ===================================================
static CommandReturn _controlAdd_HelpExecute(CommandParser *parser,
- CommandOps *ops, PARCList *args) {
+ CommandOps *ops,
+ PARCList *args,
+ char *output,
+ size_t output_size) {
CommandOps *ops_add_connection = controlAddConnection_Create(NULL);
CommandOps *ops_add_route = controlAddRoute_Create(NULL);
CommandOps *ops_add_punting = controlAddPunting_Create(NULL);
@@ -66,16 +77,21 @@ static CommandReturn _controlAdd_HelpExecute(CommandParser *parser,
#ifdef WITH_POLICY
CommandOps *ops_add_policy = controlAddPolicy_Create(NULL);
#endif /* WITH_POLICY */
-
- printf("Available commands:\n");
- printf(" %s\n", ops_add_connection->command);
- printf(" %s\n", ops_add_route->command);
- printf(" %s\n", ops_add_punting->command);
- printf(" %s\n", ops_add_listener->command);
#ifdef WITH_POLICY
- printf(" %s\n", ops_add_policy->command);
+ snprintf(output, output_size, "Available commands:\n %s\n %s\n %s\n %s\n %s\n\n",
+ ops_add_connection->command,
+ ops_add_route->command,
+ ops_add_punting->command,
+ ops_add_listener->command,
+ ops_add_policy->command);
+#else
+ snprintf(output, output_size, "Available commands:\n %s\n %s\n %s\n %s\n\n",
+ ops_add_connection->command,
+ ops_add_route->command,
+ ops_add_punting->command,
+ ops_add_listener->command);
+
#endif /* WITH_POLICY */
- printf("\n");
commandOps_Destroy(&ops_add_connection);
commandOps_Destroy(&ops_add_route);
@@ -103,7 +119,10 @@ static void _controlAdd_Init(CommandParser *parser, CommandOps *ops) {
#endif /* WITH_POLICY */
}
-static CommandReturn _controlAdd_Execute(CommandParser *parser, CommandOps *ops,
- PARCList *args) {
- return _controlAdd_HelpExecute(parser, ops, args);
+static CommandReturn _controlAdd_Execute(CommandParser *parser,
+ CommandOps *ops,
+ PARCList *args,
+ char *output,
+ size_t output_size) {
+ return _controlAdd_HelpExecute(parser, ops, args, output, output_size);
}