diff options
Diffstat (limited to 'hicn-light/src/hicn/config/controlSetWldr.c')
-rw-r--r-- | hicn-light/src/hicn/config/controlSetWldr.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/hicn-light/src/hicn/config/controlSetWldr.c b/hicn-light/src/hicn/config/controlSetWldr.c index 6d990ac19..0d4a7eca2 100644 --- a/hicn-light/src/hicn/config/controlSetWldr.c +++ b/hicn-light/src/hicn/config/controlSetWldr.c @@ -32,10 +32,15 @@ #include <hicn/utils/utils.h> static CommandReturn _controlSetWldr_Execute(CommandParser *parser, - CommandOps *ops, PARCList *args); + CommandOps *ops, + PARCList *args, + char *output, + size_t output_size); static CommandReturn _controlSetWldr_HelpExecute(CommandParser *parser, CommandOps *ops, - PARCList *args); + PARCList *args, + char *output, + size_t output_size); static const char *_commandSetWldr = "set wldr"; static const char *_commandSetWldrHelp = "help set wldr"; @@ -56,24 +61,29 @@ CommandOps *controlSetWldr_HelpCreate(ControlState *state) { static CommandReturn _controlSetWldr_HelpExecute(CommandParser *parser, CommandOps *ops, - PARCList *args) { - printf("set wldr <on|off> <connection_id>\n"); - printf("\n"); + PARCList *args, + char *output, + size_t output_size) { + snprintf(output, output_size, "set wldr <on|off> <connection_id>\n\n"); + return CommandReturn_Success; } static CommandReturn _controlSetWldr_Execute(CommandParser *parser, - CommandOps *ops, PARCList *args) { + CommandOps *ops, + PARCList *args, + char *output, + size_t output_size) { ControlState *state = ops->closure; if (parcList_Size(args) != 4) { - _controlSetWldr_HelpExecute(parser, ops, args); + _controlSetWldr_HelpExecute(parser, ops, args, output, output_size); return CommandReturn_Failure; } if (((strcmp(parcList_GetAtIndex(args, 0), "set") != 0) || (strcmp(parcList_GetAtIndex(args, 1), "wldr") != 0))) { - _controlSetWldr_HelpExecute(parser, ops, args); + _controlSetWldr_HelpExecute(parser, ops, args, output, output_size); return CommandReturn_Failure; } @@ -83,7 +93,7 @@ static CommandReturn _controlSetWldr_Execute(CommandParser *parser, } else if (strcmp(parcList_GetAtIndex(args, 2), "off") == 0) { active = false; } else { - _controlSetWldr_HelpExecute(parser, ops, args); + _controlSetWldr_HelpExecute(parser, ops, args, output, output_size); return CommandReturn_Failure; } @@ -92,7 +102,7 @@ static CommandReturn _controlSetWldr_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; |