]> git.proxmox.com Git - mirror_frr.git/blob - lib/grammar_sandbox_main.c
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else
[mirror_frr.git] / lib / grammar_sandbox_main.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Testing shim and API examples for the new CLI backend.
4 *
5 * Minimal main() to run grammar_sandbox standalone.
6 * [split off grammar_sandbox.c 2017-01-23]
7 * --
8 * Copyright (C) 2016 Cumulus Networks, Inc.
9 * Copyright (C) 2017 David Lamparter for NetDEF, Inc.
10 */
11
12 #ifdef HAVE_CONFIG_H
13 #include "config.h"
14 #endif
15
16 #include "command.h"
17 #include "lib_vty.h"
18
19 static void vty_do_exit(int isexit)
20 {
21 printf("\nend.\n");
22 if (!isexit)
23 exit(0);
24 }
25
26 struct event_loop *master;
27
28 int main(int argc, char **argv)
29 {
30 struct event event;
31
32 master = event_master_create(NULL);
33
34 zlog_aux_init("NONE: ", LOG_DEBUG);
35
36 /* Library inits. */
37 cmd_init(1);
38 cmd_hostname_set("test");
39 cmd_domainname_set("testdomainname");
40
41 vty_init(master, true);
42 lib_cmd_init();
43 nb_init(master, NULL, 0, false);
44
45 vty_stdio(vty_do_exit);
46
47 /* Fetch next active thread. */
48 while (event_fetch(master, &event))
49 event_call(&event);
50
51 /* Not reached. */
52 exit(0);
53 }