From: Martin Mares Date: Wed, 17 Nov 1999 12:00:21 +0000 (+0000) Subject: Command line interface now works. X-Git-Tag: v1.2.0~1452 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ffb59d243a350ed525850e864b38af0ecb0ffea5;p=thirdparty%2Fbird.git Command line interface now works. --- diff --git a/conf/confbase.Y b/conf/confbase.Y index bf4ed3311..bc8f5357c 100644 --- a/conf/confbase.Y +++ b/conf/confbase.Y @@ -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: diff --git a/conf/gen_parser.m4 b/conf/gen_parser.m4 index d38df21ee..70f2c2e83 100644 --- a/conf/gen_parser.m4 +++ b/conf/gen_parser.m4 @@ -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, `') diff --git a/nest/cli.c b/nest/cli.c index 41907b333..4ef0f836c 100644 --- a/nest/cli.c +++ b/nest/cli.c @@ -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); } diff --git a/nest/cli.h b/nest/cli.h index d4413ffb5..2d748db17 100644 --- a/nest/cli.h +++ b/nest/cli.h @@ -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 */