From 4b87e256eba51a8711c24fbae501ac7975b4ecd3 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Wed, 19 Jan 2000 12:30:19 +0000 Subject: Split off general commands to cmds.c. Added `show symbols' command which dumps whole symbol table together with symbol types etc. --- nest/Makefile | 2 +- nest/cli.h | 2 +- nest/cmds.c | 35 +++++++++++++++++++++++++++++++++++ nest/cmds.h | 10 ++++++++++ nest/config.Y | 12 +++++++----- 5 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 nest/cmds.c create mode 100644 nest/cmds.h (limited to 'nest') diff --git a/nest/Makefile b/nest/Makefile index 69bc06c..b9cb69b 100644 --- a/nest/Makefile +++ b/nest/Makefile @@ -1,4 +1,4 @@ -source=rt-table.c rt-fib.c rt-attr.c proto.c iface.c rt-dev.c password.c cli.c locks.c +source=rt-table.c rt-fib.c rt-attr.c proto.c iface.c rt-dev.c password.c cli.c locks.c cmds.c root-rel=../ dir-name=nest diff --git a/nest/cli.h b/nest/cli.h index 3375f21..2e76db7 100644 --- a/nest/cli.h +++ b/nest/cli.h @@ -1,7 +1,7 @@ /* * BIRD Internet Routing Daemon -- Command-Line Interface * - * (c) 1999 Martin Mares + * (c) 1999--2000 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ diff --git a/nest/cmds.c b/nest/cmds.c new file mode 100644 index 0000000..c4443f9 --- /dev/null +++ b/nest/cmds.c @@ -0,0 +1,35 @@ +/* + * BIRD Internet Routing Daemon -- CLI Commands Which Don't Fit Anywhere Else + * + * (c) 2000 Martin Mares + * + * Can be freely distributed and used under the terms of the GNU GPL. + */ + +#include "nest/bird.h" +#include "nest/cli.h" +#include "conf/conf.h" +#include "nest/cmds.h" +#include "lib/string.h" + +void +cmd_show_status(void) +{ + cli_msg(1000, "BIRD " BIRD_VERSION); + /* FIXME: Should include uptime, shutdown flag et cetera */ +} + +void +cmd_show_symbols(struct symbol *sym) +{ + int pos = 0; + + if (sym) + cli_msg(1010, "%s\t%s", sym->name, cf_symbol_class_name(sym)); + else + { + while (sym = cf_walk_symbols(config, sym, &pos)) + cli_msg(-1010, "%s\t%s", sym->name, cf_symbol_class_name(sym)); + cli_msg(0, ""); + } +} diff --git a/nest/cmds.h b/nest/cmds.h new file mode 100644 index 0000000..ae1c9e2 --- /dev/null +++ b/nest/cmds.h @@ -0,0 +1,10 @@ +/* + * BIRD Internet Routing Daemon -- CLI Commands Which Don't Fit Anywhere Else + * + * (c) 2000 Martin Mares + * + * Can be freely distributed and used under the terms of the GNU GPL. + */ + +void cmd_show_status(void); +void cmd_show_symbols(struct symbol *sym); diff --git a/nest/config.Y b/nest/config.Y index 4bccc16..d5fdc4e 100644 --- a/nest/config.Y +++ b/nest/config.Y @@ -1,7 +1,7 @@ /* * BIRD -- Core Configuration * - * (c) 1998--1999 Martin Mares + * (c) 1998--2000 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ @@ -13,6 +13,7 @@ static struct iface_patt *this_ipatt; #include "nest/rt-dev.h" #include "nest/password.h" +#include "nest/cmds.h" CF_DECLS @@ -193,10 +194,8 @@ password_list: CF_CLI_HELP(SHOW,,[[Show status information]]) -CF_CLI(SHOW STATUS,,, [[Show router status]]) { - cli_msg(1000, "BIRD " BIRD_VERSION); - /* FIXME: Should include uptime, shutdown flag et cetera */ -} ; +CF_CLI(SHOW STATUS,,, [[Show router status]]) +{ cmd_show_status(); } CF_CLI(SHOW PROTOCOLS, optsym, [], [[Show routing protocols]]) { proto_show($3, 0); } ; @@ -253,6 +252,9 @@ r_args: } ; +CF_CLI(SHOW SYMBOLS, optsym, [], [[Show all known symbolic names]]) +{ cmd_show_symbols($3); } ; + CF_CLI_HELP(DEBUG, , [[Show debugging information]]) CF_CLI(DEBUG RESOURCES,,, [[Show all allocated resource]]) { rdump(&root_pool); cli_msg(0, ""); } ; -- cgit v1.2.3