blob: 8b9a460304e796ff5608899ebb138142685769c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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 thread_master *master;
int main(int argc, char **argv)
{
struct event event;
master = thread_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);
}
|