From: Daniel Walton Date: Sun, 25 Sep 2016 16:49:39 +0000 (+0000) Subject: Expand #defines in command strings X-Git-Tag: frr-3.0-branchpoint~129^2~160 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=199d90a10eea7115c2854821ed11a229d72d1f23;p=matthieu%2Ffrr.git Expand #defines in command strings Signed-off-by: Daniel Walton --- diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index 72ea3c60ae..b2863736ce 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -610,7 +610,7 @@ DEFUN (neighbor_bfd_param, DEFUN_HIDDEN (neighbor_bfd_type, neighbor_bfd_type_cmd, - NEIGHBOR_CMD2 "bfd " BFD_CMD_TYPE, + "neighbor bfd (multihop|singlehop)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Enables BFD support\n" @@ -675,7 +675,7 @@ DEFUN (no_neighbor_bfd, DEFUN_HIDDEN (no_neighbor_bfd_type, no_neighbor_bfd_type_cmd, - NO_NEIGHBOR_CMD2 "bfd " BFD_CMD_TYPE, + "no neighbor bfd (multihop|singlehop)", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 4dcba02c24..ff5fc48f62 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -4689,9 +4689,6 @@ peer_update_source_vty (struct vty *vty, const char *peer_str, return CMD_SUCCESS; } -#define BGP_UPDATE_SOURCE_STR "A.B.C.D|X:X::X:X|WORD" -#define BGP_UPDATE_SOURCE_REQ_STR "(" BGP_UPDATE_SOURCE_STR ")" -#define BGP_UPDATE_SOURCE_OPT_STR "{" BGP_UPDATE_SOURCE_STR "}" #define BGP_UPDATE_SOURCE_HELP_STR \ "IPv4 address\n" \ "IPv6 address\n" \ diff --git a/bgpd/bgp_vty.h b/bgpd/bgp_vty.h index 573e8c7072..382af0984f 100644 --- a/bgpd/bgp_vty.h +++ b/bgpd/bgp_vty.h @@ -23,11 +23,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA struct bgp; -#define CMD_AS_RANGE "<1-4294967295>" -#define DYNAMIC_NEIGHBOR_LIMIT_RANGE "<1-5000>" -#define BGP_INSTANCE_CMD "(view|vrf) WORD" #define BGP_INSTANCE_HELP_STR "BGP view\nBGP VRF\nView/VRF name\n" -#define BGP_INSTANCE_ALL_CMD "(view|vrf) all" #define BGP_INSTANCE_ALL_HELP_STR "BGP view\nBGP VRF\nAll Views/VRFs\n" extern void bgp_vty_init (void); diff --git a/lib/bfd.h b/lib/bfd.h index bbe96b07b4..e636e4426f 100644 --- a/lib/bfd.h +++ b/lib/bfd.h @@ -26,11 +26,6 @@ #include "lib/json.h" -#define BFD_CMD_DETECT_MULT_RANGE "<2-255> " -#define BFD_CMD_MIN_RX_RANGE "<50-60000> " -#define BFD_CMD_MIN_TX_RANGE "<50-60000>" -#define BFD_CMD_TYPE "(multihop|singlehop)" - #define BFD_DEF_MIN_RX 300 #define BFD_MIN_MIN_RX 50 #define BFD_MAX_MIN_RX 60000 diff --git a/lib/command.c b/lib/command.c index 10448ef6fb..22416ea73f 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1621,7 +1621,7 @@ DEFUN_HIDDEN (do_echo, DEFUN (config_logmsg, config_logmsg_cmd, - "logmsg "LOG_LEVELS" MESSAGE...", + "logmsg MESSAGE...", "Send a message to enabled logging destinations\n" LOG_LEVEL_DESC "The message to send\n") @@ -1694,7 +1694,7 @@ DEFUN (show_logging, DEFUN (config_log_stdout, config_log_stdout_cmd, - "log stdout ["LOG_LEVELS"]", + "log stdout [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", "Logging control\n" "Set stdout logging level\n" LOG_LEVEL_DESC) @@ -1715,7 +1715,7 @@ DEFUN (config_log_stdout, DEFUN (no_config_log_stdout, no_config_log_stdout_cmd, - "no log stdout ["LOG_LEVELS"]", + "no log stdout [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", NO_STR "Logging control\n" "Cancel logging to stdout\n" @@ -1727,7 +1727,7 @@ DEFUN (no_config_log_stdout, DEFUN (config_log_monitor, config_log_monitor_cmd, - "log monitor ["LOG_LEVELS"]", + "log monitor [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", "Logging control\n" "Set terminal line (monitor) logging level\n" LOG_LEVEL_DESC) @@ -1748,7 +1748,7 @@ DEFUN (config_log_monitor, DEFUN (no_config_log_monitor, no_config_log_monitor_cmd, - "no log monitor ["LOG_LEVELS"]", + "no log monitor [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", NO_STR "Logging control\n" "Disable terminal line (monitor) logging\n" @@ -1878,7 +1878,7 @@ DEFUN (config_log_syslog, DEFUN_DEPRECATED (config_log_syslog_facility, config_log_syslog_facility_cmd, - "log syslog facility "LOG_FACILITIES, + "log syslog facility (kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7)", "Logging control\n" "Logging goes to syslog\n" "(Deprecated) Facility parameter for syslog messages\n" @@ -1932,7 +1932,7 @@ DEFUN (no_config_log_facility, DEFUN_DEPRECATED (config_log_trap, config_log_trap_cmd, - "log trap " LOG_LEVELS, + "log trap ", "Logging control\n" "(Deprecated) Set logging level and default for all destinations\n" LOG_LEVEL_DESC) @@ -1952,7 +1952,7 @@ DEFUN_DEPRECATED (config_log_trap, DEFUN_DEPRECATED (no_config_log_trap, no_config_log_trap_cmd, - "no log trap [" LOG_LEVELS "]", + "no log trap [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]", NO_STR "Logging control\n" "Permit all logging information\n" diff --git a/lib/command.h b/lib/command.h index eef4b558af..edbe69b71d 100644 --- a/lib/command.h +++ b/lib/command.h @@ -319,7 +319,6 @@ struct cmd_element */ #define CMD_CREATE_STR(s) CMD_CREATE_STR_HELPER(s) #define CMD_CREATE_STR_HELPER(s) #s -#define CMD_RANGE_STR(a,s) "<" CMD_CREATE_STR(a) "-" CMD_CREATE_STR(s) ">" /* Common descriptions. */ #define SHOW_STR "Show running system information\n" @@ -372,28 +371,18 @@ struct cmd_element /* IPv4 only machine should not accept IPv6 address for peer's IP address. So we replace VTY command string like below. */ #ifdef HAVE_IPV6 -#define NEIGHBOR_CMD "neighbor " -#define NO_NEIGHBOR_CMD "no neighbor " #define NEIGHBOR_ADDR_STR "Neighbor address\nIPv6 address\n" -#define NEIGHBOR_CMD2 "neighbor " -#define NO_NEIGHBOR_CMD2 "no neighbor " #define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor IPv6 address\nInterface name or neighbor tag\n" #define NEIGHBOR_ADDR_STR3 "Neighbor address\nIPv6 address\nInterface name\n" #else -#define NEIGHBOR_CMD "neighbor A.B.C.D " -#define NO_NEIGHBOR_CMD "no neighbor A.B.C.D " #define NEIGHBOR_ADDR_STR "Neighbor address\n" -#define NEIGHBOR_CMD2 "neighbor " -#define NO_NEIGHBOR_CMD2 "no neighbor " #define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor tag\n" #endif /* HAVE_IPV6 */ /* Dynamic neighbor (listen range) configuration */ #ifdef HAVE_IPV6 -#define LISTEN_RANGE_CMD "bgp listen range " #define LISTEN_RANGE_ADDR_STR "Neighbor address\nNeighbor IPv6 address\n" #else -#define LISTEN_RANGE_CMD "bgp listen range A.B.C.D/M " #define LISTEN_RANGE_ADDR_STR "Neighbor address\n" #endif /* HAVE_IPV6 */ diff --git a/lib/if.c b/lib/if.c index a0083933f8..3afba9879b 100644 --- a/lib/if.c +++ b/lib/if.c @@ -750,7 +750,7 @@ if_sunwzebra_get (const char *name, size_t nlen, vrf_id_t vrf_id) DEFUN (interface, interface_cmd, - "interface IFNAME ["VRF_CMD_STR"]", + "interface IFNAME [vrf NAME]", "Select an interface to configure\n" "Interface's name\n" VRF_CMD_HELP_STR) @@ -795,7 +795,7 @@ DEFUN (interface, DEFUN_NOSH (no_interface, no_interface_cmd, - "no interface IFNAME [VRF_CMD_STR]", + "no interface IFNAME [vrf NAME]", NO_STR "Delete a pseudo interface's configuration\n" "Interface's name\n" @@ -894,7 +894,7 @@ DEFUN_NOSH (no_vrf, /* For debug purpose. */ DEFUN (show_address, show_address_cmd, - "show address [VRF_CMD_STR]", + "show address [vrf NAME]", SHOW_STR "address\n" VRF_CMD_HELP_STR) diff --git a/lib/log.h b/lib/log.h index 951fa124c8..b5edc75f16 100644 --- a/lib/log.h +++ b/lib/log.h @@ -192,8 +192,6 @@ struct timestamp_control { /* Defines for use in command construction: */ -#define LOG_LEVELS "(emergencies|alerts|critical|errors|warnings|notifications|informational|debugging)" - #define LOG_LEVEL_DESC \ "System is unusable\n" \ "Immediate action needed\n" \ @@ -204,8 +202,6 @@ struct timestamp_control { "Informational messages\n" \ "Debugging messages\n" -#define LOG_FACILITIES "(kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7)" - #define LOG_FACILITY_DESC \ "Kernel\n" \ "User process\n" \ diff --git a/lib/vrf.h b/lib/vrf.h index dcc115563d..e0fd25b9b2 100644 --- a/lib/vrf.h +++ b/lib/vrf.h @@ -50,11 +50,7 @@ enum { /* * The command strings */ - -#define VRF_CMD_STR "vrf NAME" #define VRF_CMD_HELP_STR "Specify the VRF\nThe VRF name\n" - -#define VRF_ALL_CMD_STR "vrf all" #define VRF_ALL_CMD_HELP_STR "Specify the VRF\nAll VRFs\n" /* diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index b022261d2d..c834b11864 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -5757,11 +5757,6 @@ show_ip_ospf_database_maxage (struct vty *vty, struct ospf *ospf) #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n" #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as" -#define OSPF_LSA_TYPES_CMD_STR \ - "asbr-summary|external|network|router|summary" \ - OSPF_LSA_TYPE_NSSA_CMD_STR \ - OSPF_LSA_TYPE_OPAQUE_CMD_STR - #define OSPF_LSA_TYPES_DESC \ "ASBR summary link states\n" \ "External link states\n" \ diff --git a/pimd/pim_cmd.h b/pimd/pim_cmd.h index 26191cd0b6..53df562ab9 100644 --- a/pimd/pim_cmd.h +++ b/pimd/pim_cmd.h @@ -60,12 +60,6 @@ #define MROUTE_STR "IP multicast routing table\n" #define RIB_STR "IP unicast routing table\n" -#define PIM_CMD_NO "no" -#define PIM_CMD_IP_MULTICAST_ROUTING "ip multicast-routing" -#define PIM_CMD_IP_IGMP_QUERY_INTERVAL "ip igmp query-interval" -#define PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME "ip igmp query-max-response-time" -#define PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC "ip igmp query-max-response-time-dsec" - void pim_cmd_init(void); #endif /* PIM_CMD_H */ diff --git a/pimd/pim_vty.c b/pimd/pim_vty.c index f1c8930856..bc0f2c7e58 100644 --- a/pimd/pim_vty.c +++ b/pimd/pim_vty.c @@ -98,7 +98,7 @@ int pim_global_config_write(struct vty *vty) char buffer[32]; if (PIM_MROUTE_IS_ENABLED) { - vty_out(vty, "%s%s", PIM_CMD_IP_MULTICAST_ROUTING, VTY_NEWLINE); + vty_out(vty, "ip multicast-routing%s", VTY_NEWLINE); ++writes; } if (qpim_rp.rpf_addr.s_addr != INADDR_NONE) { @@ -170,8 +170,7 @@ int pim_interface_config_write(struct vty *vty) /* IF ip igmp query-interval */ if (pim_ifp->igmp_default_query_interval != IGMP_GENERAL_QUERY_INTERVAL) { - vty_out(vty, " %s %d%s", - PIM_CMD_IP_IGMP_QUERY_INTERVAL, + vty_out(vty, " ip igmp query-interval %d%s", pim_ifp->igmp_default_query_interval, VTY_NEWLINE); ++writes; @@ -180,8 +179,7 @@ int pim_interface_config_write(struct vty *vty) /* IF ip igmp query-max-response-time */ if (pim_ifp->igmp_query_max_response_time_dsec != IGMP_QUERY_MAX_RESPONSE_TIME_DSEC) { - vty_out(vty, " %s %d%s", - PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC, + vty_out(vty, " ip igmp query-max-response-time-dsec %d%s", pim_ifp->igmp_query_max_response_time_dsec, VTY_NEWLINE); ++writes; diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 4845c08d0a..8ee4cd8cc7 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -520,7 +520,7 @@ def expand_command_string(line): line = line.replace('" QUAGGA_REDIST_STR_OSPF6D "', '') line = line.replace('" QUAGGA_REDIST_STR_ISISD "', '') line = line.replace('" LOG_FACILITIES "', '') - line = line.replace('" LOG_LEVELS "', ' (emergencies|alerts|critical|errors|warnings|notifications|informational|debugging)') + line = line.replace('" LOG_LEVELS "', ' ') # endswith line = line.replace('" CMD_AS_RANGE,', ' (1-4294967295)",') @@ -552,7 +552,7 @@ def expand_command_string(line): line = line.replace('" QUAGGA_REDIST_STR_OSPF6D,', ' ",') line = line.replace('" QUAGGA_REDIST_STR_ISISD,', ' ",') line = line.replace('" LOG_FACILITIES,', ' ",') - line = line.replace('" LOG_LEVELS,', ' (emergencies|alerts|critical|errors|warnings|notifications|informational|debugging)",') + line = line.replace('" LOG_LEVELS,', ' ",') # startswith line = line.replace('LISTEN_RANGE_CMD "', '"bgp listen range ') @@ -564,7 +564,7 @@ def expand_command_string(line): line = line.replace('PIM_CMD_IP_IGMP_QUERY_INTERVAL "', '"ip igmp query-interval ') line = line.replace('PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME "', '"ip igmp query-max-response-time ') line = line.replace('PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC "', '"ip igmp query-max-response-time-dsec ') - line = line.replace('LOG_LEVELS "', '"(emergencies|alerts|critical|errors|warnings|notifications|informational|debugging) ') + line = line.replace('LOG_LEVELS "', '" ') # solo line = line.replace('NO_NEIGHBOR_CMD2,', '"no neighbor ",') diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index dd4131b701..05fb038184 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1084,7 +1084,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_BGPD, router_bgp, router_bgp_cmd, - "router bgp " CMD_AS_RANGE, + "router bgp (1-4294967295)", ROUTER_STR BGP_STR AS_STR) @@ -1103,7 +1103,7 @@ ALIAS_SH (VTYSH_BGPD, ALIAS_SH (VTYSH_BGPD, router_bgp, router_bgp_view_cmd, - "router bgp " CMD_AS_RANGE " (view|vrf) WORD", + "router bgp (1-4294967295) (view|vrf) WORD", ROUTER_STR BGP_STR AS_STR @@ -1616,7 +1616,7 @@ DEFUNSH (VTYSH_INTERFACE, ALIAS_SH (VTYSH_ZEBRA, vtysh_interface, vtysh_interface_vrf_cmd, - "interface IFNAME " VRF_CMD_STR, + "interface IFNAME vrf NAME", "Select an interface to configure\n" "Interface's name\n" VRF_CMD_HELP_STR) @@ -1631,7 +1631,7 @@ DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D, DEFSH (VTYSH_ZEBRA, vtysh_no_interface_vrf_cmd, - "no interface IFNAME " VRF_CMD_STR, + "no interface IFNAME vrf NAME", NO_STR "Delete a pseudo interface's configuration\n" "Interface's name\n" @@ -1867,7 +1867,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_ALL, vtysh_log_stdout_level, vtysh_log_stdout_level_cmd, - "log stdout "LOG_LEVELS, + "log stdout ", "Logging control\n" "Set stdout logging level\n" LOG_LEVEL_DESC) @@ -1901,7 +1901,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_ALL, vtysh_log_file_level, vtysh_log_file_level_cmd, - "log file FILENAME "LOG_LEVELS, + "log file FILENAME ", "Logging control\n" "Logging to file\n" "Logging filename\n" @@ -1945,7 +1945,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_ALL, vtysh_log_monitor_level, vtysh_log_monitor_level_cmd, - "log monitor "LOG_LEVELS, + "log monitor ", "Logging control\n" "Set terminal line (monitor) logging level\n" LOG_LEVEL_DESC) @@ -1978,7 +1978,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_ALL, vtysh_log_syslog_level, vtysh_log_syslog_level_cmd, - "log syslog "LOG_LEVELS, + "log syslog ", "Logging control\n" "Set syslog logging level\n" LOG_LEVEL_DESC) @@ -2001,7 +2001,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_ALL, vtysh_log_facility, vtysh_log_facility_cmd, - "log facility "LOG_FACILITIES, + "log facility ", "Logging control\n" "Facility parameter for syslog messages\n" LOG_FACILITY_DESC) @@ -2026,7 +2026,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH_DEPRECATED (VTYSH_ALL, vtysh_log_trap, vtysh_log_trap_cmd, - "log trap "LOG_LEVELS, + "log trap ", "Logging control\n" "(Deprecated) Set logging level and default for all destinations\n" LOG_LEVEL_DESC)