From 6de69f83055163cfc4015d609de3750af8fbff52 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 30 Sep 2016 15:31:48 +0000 Subject: [PATCH] all: added some missing <>s within []s Signed-off-by: Daniel Walton --- bgpd/bgp_route.c | 4 ++-- bgpd/bgp_routemap.c | 4 ++-- isisd/isis_redist.c | 2 +- lib/command.c | 14 +++++++------- ospf6d/ospf6_area.c | 2 +- ospf6d/ospf6_lsa.c | 4 ++-- ospf6d/ospf6_neighbor.c | 6 +++--- ospf6d/ospf6_top.c | 2 +- ospf6d/ospf6d.c | 2 +- ospfd/ospf_dump.c | 26 +++++++++++++------------- ripd/rip_interface.c | 4 ++-- tools/argv_translator.py | 23 ++++++++++++++++++++--- zebra/debug.c | 4 ++-- zebra/zebra_vty.c | 33 +++++++++++++++++++++------------ 14 files changed, 78 insertions(+), 52 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index eca6a4a7b3..bb1849e4b4 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7732,7 +7732,7 @@ bgp_show_route (struct vty *vty, const char *view_name, const char *ip_str, /* BGP route print out function. */ DEFUN (show_ip_bgp_ipv4, show_ip_bgp_ipv4_cmd, - "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast>] [cidr-only|community|<[dampening] >|regexp .LINE|route-map WORD|prefix-list WORD|filter-list WORD|community [exact-match]|community-list <(1-500)|WORD> [exact-match]| longer-prefixes] [json]", + "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast>] [|regexp .LINE|route-map WORD|prefix-list WORD|filter-list WORD|community [exact-match]|community-list <(1-500)|WORD> [exact-match]|A.B.C.D/M longer-prefixes|X:X::X:X/M longer-prefixes>] [json]", SHOW_STR IP_STR BGP_STR @@ -7857,7 +7857,7 @@ DEFUN (show_ip_bgp_ipv4, DEFUN (show_ip_bgp_route, show_ip_bgp_route_cmd, - "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast|vpnv4 unicast [rd ASN:nn_or_IP-address:nn]>] [bestpath|multipath] [json]", + "show [ip] bgp [ WORD] [< [unicast]|ipv4 multicast|vpnv4 unicast [rd ASN:nn_or_IP-address:nn]>] [] [json]", SHOW_STR IP_STR BGP_STR diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index e08b43bc17..d823b962b8 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3091,7 +3091,7 @@ DEFUN (match_ip_next_hop, DEFUN (no_match_ip_next_hop, no_match_ip_next_hop_cmd, - "no match ip next-hop [<(1-199)|(1300-2699)|WORD]", + "no match ip next-hop [<(1-199)|(1300-2699)|WORD>]", NO_STR MATCH_STR IP_STR @@ -3158,7 +3158,7 @@ DEFUN (match_ip_route_source, DEFUN (no_match_ip_route_source, no_match_ip_route_source_cmd, - "no match ip route-source [(1-199)|(1300-2699)|WORD]", + "no match ip route-source [<(1-199)|(1300-2699)|WORD>]", NO_STR MATCH_STR IP_STR diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c index e330a10170..384eb3572b 100644 --- a/isisd/isis_redist.c +++ b/isisd/isis_redist.c @@ -539,7 +539,7 @@ isis_redist_area_finish(struct isis_area *area) DEFUN (isis_redistribute, isis_redistribute_cmd, - "redistribute [metric (0-16777215)|route-map WORD]", + "redistribute []", REDIST_STR "Redistribute IPv4 routes\n" "Redistribute IPv6 routes\n" diff --git a/lib/command.c b/lib/command.c index 95d69cdbf6..c98e2562db 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1696,7 +1696,7 @@ DEFUN (show_logging, DEFUN (config_log_stdout, config_log_stdout_cmd, - "log stdout [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", + "log stdout []", "Logging control\n" "Set stdout logging level\n" LOG_LEVEL_DESC) @@ -1718,7 +1718,7 @@ DEFUN (config_log_stdout, DEFUN (no_config_log_stdout, no_config_log_stdout_cmd, - "no log stdout [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", + "no log stdout []", NO_STR "Logging control\n" "Cancel logging to stdout\n" @@ -1730,7 +1730,7 @@ DEFUN (no_config_log_stdout, DEFUN (config_log_monitor, config_log_monitor_cmd, - "log monitor [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", + "log monitor []", "Logging control\n" "Set terminal line (monitor) logging level\n" LOG_LEVEL_DESC) @@ -1752,7 +1752,7 @@ DEFUN (config_log_monitor, DEFUN (no_config_log_monitor, no_config_log_monitor_cmd, - "no log monitor [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", + "no log monitor []", NO_STR "Logging control\n" "Disable terminal line (monitor) logging\n" @@ -1818,7 +1818,7 @@ set_log_file(struct vty *vty, const char *fname, int loglevel) DEFUN (config_log_file, config_log_file_cmd, - "log file FILENAME [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", + "log file FILENAME []", "Logging control\n" "Logging to file\n" "Logging filename\n" @@ -1859,7 +1859,7 @@ DEFUN (no_config_log_file, DEFUN (config_log_syslog, config_log_syslog_cmd, - "log syslog [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", + "log syslog []", "Logging control\n" "Set syslog logging level\n" LOG_LEVEL_DESC) @@ -1897,7 +1897,7 @@ DEFUN_DEPRECATED (config_log_syslog_facility, DEFUN (no_config_log_syslog, no_config_log_syslog_cmd, - "no log syslog [] [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", + "no log syslog [] []", NO_STR "Logging control\n" "Cancel logging to syslog\n" diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index 766562a828..45e7f720f3 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -435,7 +435,7 @@ ospf6_area_show (struct vty *vty, struct ospf6_area *oa) DEFUN (area_range, area_range_cmd, - "area ]", + "area range X:X::X:X/M []", "OSPF area parameters\n" OSPF6_AREA_ID_STR "Configured address range\n" diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index c65cae3927..87e50bcf86 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -818,7 +818,7 @@ ospf6_lsa_handler_name (struct ospf6_lsa_handler *h) DEFUN (debug_ospf6_lsa_type, debug_ospf6_lsa_hex_cmd, - "debug ospf6 lsa [originate|examine|flooding]", + "debug ospf6 lsa []", DEBUG_STR OSPF6_STR "Debug Link State Advertisements (LSAs)\n" @@ -861,7 +861,7 @@ DEFUN (debug_ospf6_lsa_type, DEFUN (no_debug_ospf6_lsa_type, no_debug_ospf6_lsa_hex_cmd, - "no debug ospf6 lsa [originate|examine|flooding]", + "no debug ospf6 lsa []", NO_STR DEBUG_STR OSPF6_STR diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index 1c55175d20..91c7f7c62c 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -829,7 +829,7 @@ ospf6_neighbor_show_detail (struct vty *vty, struct ospf6_neighbor *on) DEFUN (show_ipv6_ospf6_neighbor, show_ipv6_ospf6_neighbor_cmd, - "show ipv6 ospf6 neighbor [detail|drchoice]", + "show ipv6 ospf6 neighbor []", SHOW_STR IP6_STR OSPF6_STR @@ -918,7 +918,7 @@ ospf6_neighbor_init (void) DEFUN (debug_ospf6_neighbor, debug_ospf6_neighbor_cmd, - "debug ospf6 neighbor [state|event]", + "debug ospf6 neighbor []", DEBUG_STR OSPF6_STR "Debug OSPFv3 Neighbor\n" @@ -945,7 +945,7 @@ DEFUN (debug_ospf6_neighbor, DEFUN (no_debug_ospf6_neighbor, no_debug_ospf6_neighbor_cmd, - "no debug ospf6 neighbor [state|event]", + "no debug ospf6 neighbor []", NO_STR DEBUG_STR OSPF6_STR diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 58301b1c0f..ccffa131a6 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -768,7 +768,7 @@ DEFUN (show_ipv6_ospf6, DEFUN (show_ipv6_ospf6_route, show_ipv6_ospf6_route_cmd, - "show ipv6 ospf6 route [intra-area|inter-area|external-1|external-2|X:X::X:X|X:X::X:X/M|detail|summary]", + "show ipv6 ospf6 route []", SHOW_STR IP6_STR OSPF6_STR diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index 785c9361c0..3e2db84a67 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -171,7 +171,7 @@ parse_type_spec (int idx_lsa, int argc, struct cmd_token **argv) DEFUN (show_ipv6_ospf6_database, show_ipv6_ospf6_database_cmd, - "show ipv6 ospf6 database [detail|dump|internal]", + "show ipv6 ospf6 database []", SHOW_STR IPV6_STR OSPF6_STR diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index de5c918280..91fde066f1 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -982,7 +982,7 @@ DEFUN (no_debug_ospf_ism, if (inst) // user passed instance ID { - if (!ospf_lookup_instance (strtoul (argv[2]->arg, NULL, 10))) + if (!ospf_lookup_instance (strtoul (inst, NULL, 10))) return CMD_SUCCESS; } @@ -1057,7 +1057,7 @@ debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_token DEFUN (debug_ospf_nsm, debug_ospf_nsm_cmd, - "debug ospf nsm [status|events|timers]", + "debug ospf nsm []", DEBUG_STR OSPF_STR "OSPF Neighbor State Machine\n" @@ -1070,7 +1070,7 @@ DEFUN (debug_ospf_nsm, DEFUN (debug_ospf_instance_nsm, debug_ospf_instance_nsm_cmd, - "debug ospf (1-65535) nsm [status|events|timers]", + "debug ospf (1-65535) nsm []", DEBUG_STR OSPF_STR "Instance ID\n" @@ -1128,7 +1128,7 @@ no_debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_to DEFUN (no_debug_ospf_nsm, no_debug_ospf_nsm_cmd, - "no debug ospf nsm [status|events|timers]", + "no debug ospf nsm []", NO_STR DEBUG_STR OSPF_STR @@ -1143,7 +1143,7 @@ DEFUN (no_debug_ospf_nsm, DEFUN (no_debug_ospf_instance_nsm, no_debug_ospf_instance_nsm_cmd, - "no debug ospf (1-65535) nsm [status|events|timers]", + "no debug ospf (1-65535) nsm []", NO_STR DEBUG_STR OSPF_STR @@ -1206,7 +1206,7 @@ debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, struct cmd_token DEFUN (debug_ospf_lsa, debug_ospf_lsa_cmd, - "debug ospf lsa [generate|flooding|install|refresh]", + "debug ospf lsa []", DEBUG_STR OSPF_STR "OSPF Link State Advertisement\n" @@ -1220,7 +1220,7 @@ DEFUN (debug_ospf_lsa, DEFUN (debug_ospf_instance_lsa, debug_ospf_instance_lsa_cmd, - "debug ospf (1-65535) lsa [generate|flooding|install|refresh]", + "debug ospf (1-65535) lsa []", DEBUG_STR OSPF_STR "Instance ID\n" @@ -1283,7 +1283,7 @@ no_debug_ospf_lsa_common (struct vty *vty, int arg_base, int argc, struct cmd_to DEFUN (no_debug_ospf_lsa, no_debug_ospf_lsa_cmd, - "no debug ospf lsa [generate|flooding|install|refresh]", + "no debug ospf lsa []", NO_STR DEBUG_STR OSPF_STR @@ -1298,7 +1298,7 @@ DEFUN (no_debug_ospf_lsa, DEFUN (no_debug_ospf_instance_lsa, no_debug_ospf_instance_lsa_cmd, - "no debug ospf (1-65535) lsa [generate|flooding|install|refresh]", + "no debug ospf (1-65535) lsa []", NO_STR DEBUG_STR OSPF_STR @@ -1354,7 +1354,7 @@ debug_ospf_zebra_common (struct vty *vty, int arg_base, int argc, struct cmd_tok DEFUN (debug_ospf_zebra, debug_ospf_zebra_cmd, - "debug ospf zebra [interface|redistribute]", + "debug ospf zebra []", DEBUG_STR OSPF_STR "OSPF Zebra information\n" @@ -1366,7 +1366,7 @@ DEFUN (debug_ospf_zebra, DEFUN (debug_ospf_instance_zebra, debug_ospf_instance_zebra_cmd, - "debug ospf (1-65535) zebra [interface|redistribute]", + "debug ospf (1-65535) zebra []", DEBUG_STR OSPF_STR "Instance ID\n" @@ -1420,7 +1420,7 @@ no_debug_ospf_zebra_common(struct vty *vty, int arg_base, int argc, DEFUN (no_debug_ospf_zebra, no_debug_ospf_zebra_cmd, - "no debug ospf zebra [interface|redistribute]", + "no debug ospf zebra []", NO_STR DEBUG_STR OSPF_STR @@ -1433,7 +1433,7 @@ DEFUN (no_debug_ospf_zebra, DEFUN (no_debug_ospf_instance_zebra, no_debug_ospf_instance_zebra_cmd, - "no debug ospf (1-65535) zebra [interface|redistribute]", + "no debug ospf (1-65535) zebra []", NO_STR DEBUG_STR OSPF_STR diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index d6686399c2..95fadde952 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -1400,7 +1400,7 @@ DEFUN (ip_rip_receive_version_2, DEFUN (no_ip_rip_receive_version, no_ip_rip_receive_version_cmd, - "no ip rip receive version [(1-1)|(2-2)]", + "no ip rip receive version [<1|2>]", NO_STR IP_STR "Routing Information Protocol\n" @@ -1495,7 +1495,7 @@ DEFUN (ip_rip_send_version_2, DEFUN (no_ip_rip_send_version, no_ip_rip_send_version_cmd, - "no ip rip send version [(1-1)|(2-2)]", + "no ip rip send version [<1|2>]", NO_STR IP_STR "Routing Information Protocol\n" diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 02e7bac68f..af88475d21 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -684,9 +684,26 @@ DEFUN (no_bgp_maxmed_onstartup, if not line.endswith('\n'): line += '\n' + if '|<' in line: + print "%d: ERROR |< is illegal in '%s'" % (self.line_number, line) + + if '|[' in line: + print "%d: ERROR |[ is illegal in '%s'" % (self.line_number, line) + # compress duplicate whitespaces re_space = re.search('^(\s*).*(\s*)$', line) line = re_space.group(1) + ' '.join(line.split()) + re_space.group(2) + + for token in line_to_tokens(self.line_number, line): + token = token.strip() + + if token.endswith('",'): + token = token[0:-2] + + if token.startswith('[') and '|' in token: + if not token.startswith('[<') or not token.endswith('>]'): + print "%s: suspend token '%s'" % (self.line_number, token) + return line def get_used_idx_variables(self, idx_table): @@ -743,8 +760,9 @@ DEFUN (no_bgp_maxmed_onstartup, return False def dump(self): - new_command_string = self.get_new_command_string() - new_command_string_expanded = expand_command_string(new_command_string) + # new_command_string = self.get_new_command_string() + # new_command_string_expanded = expand_command_string(new_command_string) + new_command_string_expanded = self.get_new_command_string() lines = [] lines.append("DEFUN (%s,\n" % self.name) @@ -898,7 +916,6 @@ def update_argvs(filename): state = None fh.write(line) elif line.strip().startswith('* ') and not line.strip().startswith('* '): - # dwalton new_line = expand_command_string(line[3:]) # chop the leading " * " fh.write(" * %s" % new_line) else: diff --git a/zebra/debug.c b/zebra/debug.c index 3714ffe3f6..6acf32b43d 100644 --- a/zebra/debug.c +++ b/zebra/debug.c @@ -174,7 +174,7 @@ DEFUN (debug_zebra_kernel, DEFUN (debug_zebra_kernel_msgdump, debug_zebra_kernel_msgdump_cmd, - "debug zebra kernel msgdump [recv|send]", + "debug zebra kernel msgdump []", DEBUG_STR "Zebra configuration\n" "Debug option set for zebra between kernel interface\n" @@ -292,7 +292,7 @@ DEFUN (no_debug_zebra_kernel, DEFUN (no_debug_zebra_kernel_msgdump, no_debug_zebra_kernel_msgdump_cmd, - "no debug zebra kernel msgdump [recv|send]", + "no debug zebra kernel msgdump []", DEBUG_STR "Zebra configuration\n" "Debug option set for zebra between kernel interface\n" diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index e6e7f5d2ea..7f1a042f56 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -208,9 +208,9 @@ DEFUN (no_ip_mroute_dist, "Nexthop interface name\n" "Distance\n") { - char *destprefix = argv[2]->arg; - char *nexthop = argv[3]->arg; - char *distance = (argc == 5) ? argv[4]->arg : NULL; + char *destprefix = argv[3]->arg; + char *nexthop = argv[4]->arg; + char *distance = (argc == 6) ? argv[5]->arg : NULL; return zebra_static_ipv4 (vty, SAFI_MULTICAST, 0, destprefix, NULL, nexthop, NULL, NULL, distance, NULL); } @@ -1392,6 +1392,9 @@ DEFUN (show_ip_route_tag, "Show only routes with tag\n" "Tag value\n") { + int idx_vrf = 3; + int idx_name = 4; + int idx_tag = 6; struct route_table *table; struct route_node *rn; struct rib *rib; @@ -1399,14 +1402,15 @@ DEFUN (show_ip_route_tag, u_short tag = 0; vrf_id_t vrf_id = VRF_DEFAULT; - if (strmatch(argv[3]->text, "vrf")) + if (strmatch(argv[idx_vrf]->text, "vrf")) { - VRF_GET_ID (vrf_id, argv[4]->arg); - tag = atoi(argv[6]->arg); + VRF_GET_ID (vrf_id, argv[idx_name]->arg); + tag = atoi(argv[idx_tag]->arg); } else { - tag = atoi(argv[4]->arg); + idx_tag -= 2; + tag = atoi(argv[idx_tag]->arg); } table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); @@ -2852,6 +2856,9 @@ DEFUN (show_ipv6_route_tag, "Show only routes with tag\n" "Tag value\n") { + int idx_vrf = 3; + int idx_name = 4; + int idx_tag = 6; struct route_table *table; struct route_node *rn; struct rib *rib; @@ -2859,14 +2866,15 @@ DEFUN (show_ipv6_route_tag, u_short tag = 0; vrf_id_t vrf_id = VRF_DEFAULT; - if (strmatch(argv[3]->text, "vrf")) + if (strmatch(argv[idx_vrf]->text, "vrf")) { - VRF_GET_ID (vrf_id, argv[4]->arg); - tag = atoi(argv[6]->arg); + VRF_GET_ID (vrf_id, argv[idx_name]->arg); + tag = atoi(argv[idx_tag]->arg); } else { - tag = atoi(argv[4]->arg); + idx_tag -= 2; + tag = atoi(argv[idx_tag]->arg); } table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); @@ -3352,6 +3360,7 @@ DEFUN (show_ipv6_route_vrf_all_protocol, VRF_ALL_CMD_HELP_STR QUAGGA_IP6_REDIST_HELP_STR_ZEBRA) { + int idx_protocol = 5; int type; struct route_table *table; struct route_node *rn; @@ -3361,7 +3370,7 @@ DEFUN (show_ipv6_route_vrf_all_protocol, int first = 1; int vrf_header = 1; - type = proto_redistnum (AFI_IP6, argv[4]->arg); + type = proto_redistnum (AFI_IP6, argv[idx_protocol]->arg); if (type < 0) { vty_out (vty, "Unknown route type%s", VTY_NEWLINE); -- 2.39.5