]> git.proxmox.com Git - mirror_frr.git/blame - lib/grammar_sandbox_main.c
*: auto-convert to SPDX License IDs
[mirror_frr.git] / lib / grammar_sandbox_main.c
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
af2567b6
DL
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.
af2567b6
DL
10 */
11
b45ac5f5
DL
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
15
af2567b6 16#include "command.h"
1c0d8808 17#include "lib_vty.h"
af2567b6 18
154b9e8f 19static void vty_do_exit(int isexit)
af2567b6 20{
d62a17ae 21 printf("\nend.\n");
154b9e8f
DL
22 if (!isexit)
23 exit(0);
af2567b6
DL
24}
25
26struct thread_master *master;
27
28int main(int argc, char **argv)
29{
d62a17ae 30 struct thread thread;
af2567b6 31
d62a17ae 32 master = thread_master_create(NULL);
af2567b6 33
0bdeb5e5 34 zlog_aux_init("NONE: ", LOG_DEBUG);
af2567b6 35
d62a17ae 36 /* Library inits. */
37 cmd_init(1);
8586a88a
DS
38 cmd_hostname_set("test");
39 cmd_domainname_set("testdomainname");
af2567b6 40
2950f5da 41 vty_init(master, true);
1c0d8808 42 lib_cmd_init();
390a8862 43 nb_init(master, NULL, 0, false);
af2567b6 44
d62a17ae 45 vty_stdio(vty_do_exit);
af2567b6 46
d62a17ae 47 /* Fetch next active thread. */
48 while (thread_fetch(master, &thread))
49 thread_call(&thread);
af2567b6 50
d62a17ae 51 /* Not reached. */
52 exit(0);
af2567b6 53}