summaryrefslogtreecommitdiffstats
path: root/lib/grammar_sandbox_main.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-09 13:16:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-09 13:16:35 +0000
commite2bbf175a2184bd76f6c54ccf8456babeb1a46fc (patch)
treef0b76550d6e6f500ada964a3a4ee933a45e5a6f1 /lib/grammar_sandbox_main.c
parentInitial commit. (diff)
downloadfrr-e2bbf175a2184bd76f6c54ccf8456babeb1a46fc.tar.xz
frr-e2bbf175a2184bd76f6c54ccf8456babeb1a46fc.zip
Adding upstream version 9.1.upstream/9.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/grammar_sandbox_main.c')
-rw-r--r--lib/grammar_sandbox_main.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/lib/grammar_sandbox_main.c b/lib/grammar_sandbox_main.c
new file mode 100644
index 0000000..abd42f3
--- /dev/null
+++ b/lib/grammar_sandbox_main.c
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Testing shim and API examples for the new CLI backend.
+ *
+ * Minimal main() to run grammar_sandbox standalone.
+ * [split off grammar_sandbox.c 2017-01-23]
+ * --
+ * Copyright (C) 2016 Cumulus Networks, Inc.
+ * Copyright (C) 2017 David Lamparter for NetDEF, Inc.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "command.h"
+#include "lib_vty.h"
+
+static void vty_do_exit(int isexit)
+{
+ printf("\nend.\n");
+ if (!isexit)
+ exit(0);
+}
+
+struct event_loop *master;
+
+int main(int argc, char **argv)
+{
+ struct event event;
+
+ master = event_master_create(NULL);
+
+ zlog_aux_init("NONE: ", LOG_DEBUG);
+
+ /* Library inits. */
+ cmd_init(1);
+ cmd_hostname_set("test");
+ cmd_domainname_set("testdomainname");
+
+ vty_init(master, true);
+ lib_cmd_init();
+ nb_init(master, NULL, 0, false);
+
+ vty_stdio(vty_do_exit);
+
+ /* Fetch next active thread. */
+ while (event_fetch(master, &event))
+ event_call(&event);
+
+ /* Not reached. */
+ exit(0);
+}