From 7fc626de5f618133ad2a478d13defa3a110b89ea Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 1 Dec 2008 11:10:34 -0800 Subject: [cleanup] Make command nodes static The cmd_nodes used to configure vty, can mostly be static so (basic data hiding 101). --- bgpd/bgp_debug.c | 2 +- bgpd/bgp_dump.c | 2 +- bgpd/bgp_filter.c | 2 +- bgpd/bgp_vty.c | 14 +++++++------- isisd/isis_circuit.c | 2 +- isisd/isisd.c | 2 +- lib/command.c | 12 ++++++------ lib/filter.c | 4 ++-- lib/keychain.c | 4 ++-- lib/plist.c | 4 ++-- lib/routemap.c | 2 +- lib/smux.c | 2 +- ospf6d/ospf6_interface.c | 2 +- ospf6d/ospf6_top.c | 2 +- ospf6d/ospf6_zebra.c | 2 +- ospf6d/ospf6d.c | 2 +- ospfd/ospf_dump.c | 2 +- ospfd/ospf_vty.c | 11 ++--------- ripd/rip_debug.c | 2 +- ripd/rip_interface.c | 2 +- ripd/rip_zebra.c | 2 +- ripd/ripd.c | 2 +- ripngd/ripng_debug.c | 2 +- ripngd/ripng_interface.c | 2 +- ripngd/ripng_zebra.c | 2 +- ripngd/ripngd.c | 2 +- vtysh/vtysh.c | 32 ++++++++++++++++---------------- zebra/zebra_vty.c | 4 ++-- zebra/zserv.c | 4 ++-- 29 files changed, 61 insertions(+), 68 deletions(-) diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index 1d5bf6b9..fa316c5e 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -856,7 +856,7 @@ bgp_config_write_debug (struct vty *vty) return write; } -struct cmd_node debug_node = +static struct cmd_node debug_node = { DEBUG_NODE, "", diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index e815ea3c..53dea805 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -773,7 +773,7 @@ DEFUN (no_dump_bgp_routes, } /* BGP node structure. */ -struct cmd_node bgp_dump_node = +static struct cmd_node bgp_dump_node = { DUMP_NODE, "", diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c index 89e48bf8..bdb756cb 100644 --- a/bgpd/bgp_filter.c +++ b/bgpd/bgp_filter.c @@ -671,7 +671,7 @@ config_write_as_list (struct vty *vty) return write; } -struct cmd_node as_list_node = +static struct cmd_node as_list_node = { AS_LIST_NODE, "", diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 76c537b4..e79e4775 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -8775,42 +8775,42 @@ bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, } /* BGP node structure. */ -struct cmd_node bgp_node = +static struct cmd_node bgp_node = { BGP_NODE, "%s(config-router)# ", 1, }; -struct cmd_node bgp_ipv4_unicast_node = +static struct cmd_node bgp_ipv4_unicast_node = { BGP_IPV4_NODE, "%s(config-router-af)# ", 1, }; -struct cmd_node bgp_ipv4_multicast_node = +static struct cmd_node bgp_ipv4_multicast_node = { BGP_IPV4M_NODE, "%s(config-router-af)# ", 1, }; -struct cmd_node bgp_ipv6_unicast_node = +static struct cmd_node bgp_ipv6_unicast_node = { BGP_IPV6_NODE, "%s(config-router-af)# ", 1, }; -struct cmd_node bgp_ipv6_multicast_node = +static struct cmd_node bgp_ipv6_multicast_node = { BGP_IPV6M_NODE, "%s(config-router-af)# ", 1, }; -struct cmd_node bgp_vpnv4_node = +static struct cmd_node bgp_vpnv4_node = { BGP_VPNV4_NODE, "%s(config-router-af)# ", @@ -10734,7 +10734,7 @@ community_list_config_write (struct vty *vty) return write; } -struct cmd_node community_list_node = +static struct cmd_node community_list_node = { COMMUNITY_LIST_NODE, "", diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index af24988e..d2923b57 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -2028,7 +2028,7 @@ DEFUN (no_ipv6_router_isis, } #endif /* HAVE_IPV6 */ -struct cmd_node interface_node = { +static struct cmd_node interface_node = { INTERFACE_NODE, "%s(config-if)# ", 1, diff --git a/isisd/isisd.c b/isisd/isisd.c index 7c669fcb..1e84a1ce 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -2076,7 +2076,7 @@ isis_config_write (struct vty *vty) return write; } -struct cmd_node isis_node = { +static struct cmd_node isis_node = { ISIS_NODE, "%s(config-router)# ", 1 diff --git a/lib/command.c b/lib/command.c index 4887f94f..0bbd99e5 100644 --- a/lib/command.c +++ b/lib/command.c @@ -41,37 +41,37 @@ vector cmdvec = NULL; struct host host; /* Standard command node structures. */ -struct cmd_node auth_node = +static struct cmd_node auth_node = { AUTH_NODE, "Password: ", }; -struct cmd_node view_node = +static struct cmd_node view_node = { VIEW_NODE, "%s> ", }; -struct cmd_node restricted_node = +static struct cmd_node restricted_node = { RESTRICTED_NODE, "%s$ ", }; -struct cmd_node auth_enable_node = +static struct cmd_node auth_enable_node = { AUTH_ENABLE_NODE, "Password: ", }; -struct cmd_node enable_node = +static struct cmd_node enable_node = { ENABLE_NODE, "%s# ", }; -struct cmd_node config_node = +static struct cmd_node config_node = { CONFIG_NODE, "%s(config)# ", diff --git a/lib/filter.c b/lib/filter.c index 7aeb8deb..af8d587f 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -1857,7 +1857,7 @@ config_write_access (struct vty *vty, afi_t afi) } /* Access-list node. */ -struct cmd_node access_node = +static struct cmd_node access_node = { ACCESS_NODE, "", /* Access list has no interface. */ @@ -1953,7 +1953,7 @@ access_list_init_ipv4 (void) } #ifdef HAVE_IPV6 -struct cmd_node access_ipv6_node = +static struct cmd_node access_ipv6_node = { ACCESS_IPV6_NODE, "", diff --git a/lib/keychain.c b/lib/keychain.c index af0a1d74..6719cebf 100644 --- a/lib/keychain.c +++ b/lib/keychain.c @@ -848,14 +848,14 @@ DEFUN (send_lifetime_duration_month_day, argv[3], argv[4]); } -struct cmd_node keychain_node = +static struct cmd_node keychain_node = { KEYCHAIN_NODE, "%s(config-keychain)# ", 1 }; -struct cmd_node keychain_key_node = +static struct cmd_node keychain_key_node = { KEYCHAIN_KEY_NODE, "%s(config-keychain-key)# ", diff --git a/lib/plist.c b/lib/plist.c index 4b498c4d..0f802a83 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -2623,7 +2623,7 @@ prefix_list_reset_orf (void) /* Prefix-list node. */ -struct cmd_node prefix_node = +static struct cmd_node prefix_node = { PREFIX_NODE, "", /* Prefix list has no interface. */ @@ -2732,7 +2732,7 @@ prefix_list_init_ipv4 (void) #ifdef HAVE_IPV6 /* Prefix-list node. */ -struct cmd_node prefix_ipv6_node = +static struct cmd_node prefix_ipv6_node = { PREFIX_IPV6_NODE, "", /* Prefix list has no interface. */ diff --git a/lib/routemap.c b/lib/routemap.c index 58ed09a7..5f7a3182 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -1280,7 +1280,7 @@ route_map_config_write (struct vty *vty) } /* Route map node structure. */ -struct cmd_node rmap_node = +static struct cmd_node rmap_node = { RMAP_NODE, "%s(config-route-map)# ", diff --git a/lib/smux.c b/lib/smux.c index fd0c89c2..349cc2f7 100644 --- a/lib/smux.c +++ b/lib/smux.c @@ -73,7 +73,7 @@ int debug_smux = 0; int fail = 0; /* SMUX node. */ -struct cmd_node smux_node = +static struct cmd_node smux_node = { SMUX_NODE, "" /* SMUX has no interface. */ diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 42152084..5a79862f 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -1509,7 +1509,7 @@ config_write_ospf6_interface (struct vty *vty) return 0; } -struct cmd_node interface_node = +static struct cmd_node interface_node = { INTERFACE_NODE, "%s(config-if)# ", diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index d45d1321..609df41c 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -650,7 +650,7 @@ config_write_ospf6 (struct vty *vty) } /* OSPF6 node structure. */ -struct cmd_node ospf6_node = +static struct cmd_node ospf6_node = { OSPF6_NODE, "%s(config-ospf6)# ", diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index b5ffc0aa..7083c966 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -335,7 +335,7 @@ config_write_ospf6_zebra (struct vty *vty) } /* Zebra node structure. */ -struct cmd_node zebra_node = +static struct cmd_node zebra_node = { ZEBRA_NODE, "%s(config-zebra)# ", diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index 1a615ffa..7a766c8d 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -92,7 +92,7 @@ DEFUN (show_version_ospf6, return CMD_SUCCESS; } -struct cmd_node debug_node = +static struct cmd_node debug_node = { DEBUG_NODE, "", diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index 2fcbfe64..de9ef055 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -1509,7 +1509,7 @@ DEFUN (show_debugging_ospf, } /* Debug node. */ -struct cmd_node debug_node = +static struct cmd_node debug_node = { DEBUG_NODE, "", diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index c4abe7e1..2e4b6078 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -8073,7 +8073,7 @@ ospf_vty_show_init (void) /* ospfd's interface node. */ -struct cmd_node interface_node = +static struct cmd_node interface_node = { INTERFACE_NODE, "%s(config-if)# ", @@ -8184,13 +8184,6 @@ ospf_vty_if_init (void) install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd); } -/* Zebra node structure. */ -struct cmd_node zebra_node = -{ - ZEBRA_NODE, - "%s(config-router)#", -}; - static void ospf_vty_zebra_init (void) { @@ -8283,7 +8276,7 @@ ospf_vty_zebra_init (void) #endif /* 0 */ } -struct cmd_node ospf_node = +static struct cmd_node ospf_node = { OSPF_NODE, "%s(config-router)# ", diff --git a/ripd/rip_debug.c b/ripd/rip_debug.c index d788ea7e..64dc27c0 100644 --- a/ripd/rip_debug.c +++ b/ripd/rip_debug.c @@ -203,7 +203,7 @@ DEFUN (no_debug_rip_zebra, } /* Debug node. */ -struct cmd_node debug_node = +static struct cmd_node debug_node = { DEBUG_NODE, "", /* Debug node has no interface. */ diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 54d357ce..827663ac 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -2051,7 +2051,7 @@ config_write_rip_network (struct vty *vty, int config_mode) return 0; } -struct cmd_node interface_node = +static struct cmd_node interface_node = { INTERFACE_NODE, "%s(config-if)# ", diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c index b924199f..7729d9b4 100644 --- a/ripd/rip_zebra.c +++ b/ripd/rip_zebra.c @@ -651,7 +651,7 @@ config_write_rip_redistribute (struct vty *vty, int config_mode) } /* Zebra node structure. */ -struct cmd_node zebra_node = +static struct cmd_node zebra_node = { ZEBRA_NODE, "%s(config-router)# ", diff --git a/ripd/ripd.c b/ripd/ripd.c index cb2603d0..0e3f877d 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -3680,7 +3680,7 @@ config_write_rip (struct vty *vty) } /* RIP node structure. */ -struct cmd_node rip_node = +static struct cmd_node rip_node = { RIP_NODE, "%s(config-router)# ", diff --git a/ripngd/ripng_debug.c b/ripngd/ripng_debug.c index 4ed4fa36..78f13a71 100644 --- a/ripngd/ripng_debug.c +++ b/ripngd/ripng_debug.c @@ -204,7 +204,7 @@ DEFUN (no_debug_ripng_zebra, } /* Debug node. */ -struct cmd_node debug_node = +static struct cmd_node debug_node = { DEBUG_NODE, "", /* Debug node has no interface. */ diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index d76e3a13..d70c299d 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -1200,7 +1200,7 @@ interface_config_write (struct vty *vty) } /* ripngd's interface node. */ -struct cmd_node interface_node = +static struct cmd_node interface_node = { INTERFACE_NODE, "%s(config-if)# ", diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c index 62185c0a..4c444550 100644 --- a/ripngd/ripng_zebra.c +++ b/ripngd/ripng_zebra.c @@ -538,7 +538,7 @@ zebra_config_write (struct vty *vty) } /* Zebra node structure. */ -struct cmd_node zebra_node = +static struct cmd_node zebra_node = { ZEBRA_NODE, "%s(config-router)# ", diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 7b00e037..9deac032 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -2682,7 +2682,7 @@ ripng_config_write (struct vty *vty) } /* RIPng node structure. */ -struct cmd_node cmd_ripng_node = +static struct cmd_node cmd_ripng_node = { RIPNG_NODE, "%s(config-router)# ", diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index bad05d98..32b626c7 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -711,97 +711,97 @@ vtysh_completion (char *text, int start, int end) #endif /* Vty node structures. */ -struct cmd_node bgp_node = +static struct cmd_node bgp_node = { BGP_NODE, "%s(config-router)# ", }; -struct cmd_node rip_node = +static struct cmd_node rip_node = { RIP_NODE, "%s(config-router)# ", }; -struct cmd_node isis_node = +static struct cmd_node isis_node = { ISIS_NODE, "%s(config-router)# ", }; -struct cmd_node interface_node = +static struct cmd_node interface_node = { INTERFACE_NODE, "%s(config-if)# ", }; -struct cmd_node rmap_node = +static struct cmd_node rmap_node = { RMAP_NODE, "%s(config-route-map)# " }; -struct cmd_node zebra_node = +static struct cmd_node zebra_node = { ZEBRA_NODE, "%s(config-router)# " }; -struct cmd_node bgp_vpnv4_node = +static struct cmd_node bgp_vpnv4_node = { BGP_VPNV4_NODE, "%s(config-router-af)# " }; -struct cmd_node bgp_ipv4_node = +static struct cmd_node bgp_ipv4_node = { BGP_IPV4_NODE, "%s(config-router-af)# " }; -struct cmd_node bgp_ipv4m_node = +static struct cmd_node bgp_ipv4m_node = { BGP_IPV4M_NODE, "%s(config-router-af)# " }; -struct cmd_node bgp_ipv6_node = +static struct cmd_node bgp_ipv6_node = { BGP_IPV6_NODE, "%s(config-router-af)# " }; -struct cmd_node bgp_ipv6m_node = +static struct cmd_node bgp_ipv6m_node = { BGP_IPV6M_NODE, "%s(config-router-af)# " }; -struct cmd_node ospf_node = +static struct cmd_node ospf_node = { OSPF_NODE, "%s(config-router)# " }; -struct cmd_node ripng_node = +static struct cmd_node ripng_node = { RIPNG_NODE, "%s(config-router)# " }; -struct cmd_node ospf6_node = +static struct cmd_node ospf6_node = { OSPF6_NODE, "%s(config-ospf6)# " }; -struct cmd_node keychain_node = +static struct cmd_node keychain_node = { KEYCHAIN_NODE, "%s(config-keychain)# " }; -struct cmd_node keychain_key_node = +static struct cmd_node keychain_key_node = { KEYCHAIN_KEY_NODE, "%s(config-keychain-key)# " diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 0c313921..f50ab05e 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -2030,10 +2030,10 @@ static int config_write_protocol(struct vty *vty) } /* table node for protocol filtering */ -struct cmd_node protocol_node = { PROTOCOL_NODE, "", 1 }; +static struct cmd_node protocol_node = { PROTOCOL_NODE, "", 1 }; /* IP node for static routes. */ -struct cmd_node ip_node = { IP_NODE, "", 1 }; +static struct cmd_node ip_node = { IP_NODE, "", 1 }; /* Route VTY. */ void diff --git a/zebra/zserv.c b/zebra/zserv.c index ef79eaad..05380d62 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -1569,7 +1569,7 @@ config_write_table (struct vty *vty) } /* table node for routing tables. */ -struct cmd_node table_node = +static struct cmd_node table_node = { TABLE_NODE, "", /* This node has no interface. */ @@ -1689,7 +1689,7 @@ config_write_forwarding (struct vty *vty) } /* table node for routing tables. */ -struct cmd_node forwarding_node = +static struct cmd_node forwarding_node = { FORWARDING_NODE, "", /* This node has no interface. */ -- cgit v1.2.1