]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Command line interface now works.
authorMartin Mares <mj@ucw.cz>
Wed, 17 Nov 1999 12:00:21 +0000 (12:00 +0000)
committerMartin Mares <mj@ucw.cz>
Wed, 17 Nov 1999 12:00:21 +0000 (12:00 +0000)
conf/confbase.Y
conf/gen_parser.m4
nest/cli.c
nest/cli.h

index bf4ed331174883b39a2cac2a72665a2dc9e72b59..bc8f5357c4821c41fa0a1e65732b995ad09c9aaa 100644 (file)
@@ -58,7 +58,7 @@ CF_GRAMMAR
 /* Basic config file structure */
 
 config: conf_entries END { return 0; }
- | CLI_MARKER cli_cmd END { return 0; }
+ | CLI_MARKER cli_cmd { return 0; }
  ;
 
 conf_entries:
index d38df21ee4d9e60425769d6f6da6b929edb58c30..70f2c2e839430e79c65a8c38c1dbf19fb72eb9cb 100644 (file)
@@ -42,7 +42,8 @@ m4_define(CF_ADDTO, `m4_define([[CF_rule_$1]],m4_ifdef([[CF_rule_$1]],CF_rule_$1
 m4_define(CF_CLI, `m4_define([[CF_cmd]], cmd_[[]]m4_translit($1, [[ ]], _))DNL
 m4_divert(2)CF_KEYWORDS(m4_translit($1, [[ ]], [[,]]))
 m4_divert(3)CF_ADDTO(cli_cmd, CF_cmd)
-CF_cmd: $1 ')
+CF_cmd: $1 $2 END')
+m4_define(CF_CLI_HELP, `')
 
 # ENUM declarations are ignored
 m4_define(CF_ENUM, `')
index 41907b333ec2a2d42535dc3223bea19fcddb1a45..4ef0f836c54eb62d0f4c4957dc40421897f0f33c 100644 (file)
@@ -171,6 +171,7 @@ cli_new(void *priv)
   c->event->data = c;
   c->tx_buf = c->tx_pos = c->tx_write = NULL;
   c->cont = cli_hello;
+  c->cleanup = NULL;
   c->last_reply = 0;
   c->parser_pool = lp_new(c->pool, 4096);
   ev_schedule(c->event);
@@ -194,6 +195,8 @@ cli_written(cli *c)
 void
 cli_free(cli *c)
 {
+  if (c->cleanup)
+    c->cleanup(c);
   rfree(c->pool);
 }
 
index d4413ffb510ee380cea1d020d8d070e9f183af2f..2d748db1778ce5bb7ef74a3df0ec703655170aeb 100644 (file)
@@ -29,6 +29,7 @@ typedef struct cli {
   struct cli_out *tx_buf, *tx_pos, *tx_write;
   event *event;
   void (*cont)(struct cli *c);
+  void (*cleanup)(struct cli *c);
   void *rover;                         /* Private to continuation routine */
   int last_reply;
   struct linpool *parser_pool;         /* Pool used during parsing */