From 0f808c066f3b5b190de951db042a34a1eb957a16 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Fri, 16 Mar 2012 12:47:12 +0100 Subject: Adds filtering to 'show symbols' command. Thanks Alexander V. Chernikov for the original patch. --- nest/cmds.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'nest/cmds.c') diff --git a/nest/cmds.c b/nest/cmds.c index 8ac32096..62d7c9b4 100644 --- a/nest/cmds.c +++ b/nest/cmds.c @@ -7,6 +7,7 @@ */ #include "nest/bird.h" +#include "nest/route.h" #include "nest/cli.h" #include "conf/conf.h" #include "nest/cmds.h" @@ -35,16 +36,22 @@ cmd_show_status(void) } void -cmd_show_symbols(struct symbol *sym) +cmd_show_symbols(struct sym_show_data *sd) { int pos = 0; + struct symbol *sym = sd->sym; if (sym) - cli_msg(1010, "%s\t%s", sym->name, cf_symbol_class_name(sym)); + cli_msg(1010, "%-8s\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)); + { + if (sd->type && (sym->class != sd->type)) + continue; + + cli_msg(-1010, "%-8s\t%s", sym->name, cf_symbol_class_name(sym)); + } cli_msg(0, ""); } } -- cgit v1.2.3