frr/lib/grammar_sandbox.c

34 lines
676 B
C
Raw Normal View History

2016-06-23 16:47:32 +02:00
#include "command.h"
#include "command_parse.h"
2016-06-23 16:47:32 +02:00
#define GRAMMAR_STR "CLI grammar sandbox\n"
DEFUN (grammar_test,
grammar_test_cmd,
"grammar .COMMAND",
2016-06-23 16:47:32 +02:00
GRAMMAR_STR
"command to pass to new parser\n")
2016-06-23 16:47:32 +02:00
{
size_t linesize = 0;
for (int i = 0; i < argc; i++)
linesize += strlen(argv[i]) + 1;
2016-06-23 16:47:32 +02:00
char* cat = malloc(linesize);
cat[0] = '\0';
for (int i = 0; i < argc; i++) {
strcat(cat, argv[i]);
if (i != argc)
strcat(cat, " ");
}
2016-06-23 16:47:32 +02:00
cmd_parse_format_new((const char*) cat, "lol");
2016-06-23 16:47:32 +02:00
return CMD_SUCCESS;
2016-06-23 16:47:32 +02:00
}
void grammar_sandbox_init(void);
void grammar_sandbox_init() {
install_element (ENABLE_NODE, &grammar_test_cmd);
2016-06-23 16:47:32 +02:00
}