]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/grammar_sandbox_main.c
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
[mirror_frr.git] / lib / grammar_sandbox_main.c
index 3bf0e268cfd16becff34a1eb08c2ebabe58ae7dd..c9c942f9bf897a02599dea196ce1dcea5463556a 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "command.h"
 #include "memory_vty.h"
 
-static void vty_do_exit(void)
+static void vty_do_exit(int isexit)
 {
-  printf ("\nend.\n");
-  exit (0);
+       printf("\nend.\n");
+       if (!isexit)
+               exit(0);
 }
 
 struct thread_master *master;
 
 int main(int argc, char **argv)
 {
-  struct thread thread;
+       struct thread thread;
 
-  master = thread_master_create ();
+       master = thread_master_create(NULL);
 
-  openzlog ("grammar_sandbox", "NONE", 0,
-                           LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON);
-  zlog_set_level (ZLOG_DEST_SYSLOG, ZLOG_DISABLED);
-  zlog_set_level (ZLOG_DEST_STDOUT, LOG_DEBUG);
-  zlog_set_level (ZLOG_DEST_MONITOR, ZLOG_DISABLED);
+       openzlog("grammar_sandbox", "NONE", 0, LOG_CONS | LOG_NDELAY | LOG_PID,
+                LOG_DAEMON);
+       zlog_set_level(ZLOG_DEST_SYSLOG, ZLOG_DISABLED);
+       zlog_set_level(ZLOG_DEST_STDOUT, LOG_DEBUG);
+       zlog_set_level(ZLOG_DEST_MONITOR, ZLOG_DISABLED);
 
-  /* Library inits. */
-  cmd_init (1);
-  host.name = strdup ("test");
+       /* Library inits. */
+       cmd_init(1);
+       host.name = strdup("test");
+       host.domainname = strdup("testdomainname");
 
-  vty_init (master);
-  memory_init ();
+       vty_init(master);
+       memory_init();
 
-  vty_stdio (vty_do_exit);
+       vty_stdio(vty_do_exit);
 
-  /* Fetch next active thread. */
-  while (thread_fetch (master, &thread))
-    thread_call (&thread);
+       /* Fetch next active thread. */
+       while (thread_fetch(master, &thread))
+               thread_call(&thread);
 
-  /* Not reached. */
-  exit (0);
+       /* Not reached. */
+       exit(0);
 }