diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2018-09-08 21:46:23 +0200 | 
|---|---|---|
| committer | David Lamparter <equinox@diac24.net> | 2020-04-16 12:53:00 +0200 | 
| commit | 62b346eefa1b9e09c9372f5b6376e1bca4162015 (patch) | |
| tree | 2e3bc16d1d0765ab033c7ffd24ca58b3b5d35168 /lib | |
| parent | 4c749d99dcdc7f0d811d0bbd2858b87f41e4feba (diff) | |
*: clean up cmd_node initializers
... and use named assignments everywhere (so I can change the struct.)
Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/agentx.c | 8 | ||||
| -rw-r--r-- | lib/command.c | 18 | ||||
| -rw-r--r-- | lib/filter.c | 20 | ||||
| -rw-r--r-- | lib/keychain.c | 16 | ||||
| -rw-r--r-- | lib/nexthop_group.c | 6 | ||||
| -rw-r--r-- | lib/northbound_cli.c | 6 | ||||
| -rw-r--r-- | lib/plist.c | 14 | ||||
| -rw-r--r-- | lib/resolver.c | 6 | ||||
| -rw-r--r-- | lib/routemap.c | 6 | ||||
| -rw-r--r-- | lib/routemap_cli.c | 6 | ||||
| -rw-r--r-- | lib/vrf.c | 12 | ||||
| -rw-r--r-- | lib/vty.c | 4 | 
12 files changed, 88 insertions, 34 deletions
diff --git a/lib/agentx.c b/lib/agentx.c index d1b801fe8c..0215affd9e 100644 --- a/lib/agentx.c +++ b/lib/agentx.c @@ -158,9 +158,11 @@ static void agentx_events_update(void)  }  /* AgentX node. */ -static struct cmd_node agentx_node = {SMUX_NODE, -				      "", /* AgentX has no interface. */ -				      1}; +static struct cmd_node agentx_node = { +	.node = SMUX_NODE, +	.prompt = "", +	.vtysh = 1, +};  /* Logging NetSNMP messages */  static int agentx_log_callback(int major, int minor, void *serverarg, diff --git a/lib/command.c b/lib/command.c index 8811b3a791..85ccbbf191 100644 --- a/lib/command.c +++ b/lib/command.c @@ -181,22 +181,30 @@ const char *cmd_domainname_get(void)  /* Standard command node structures. */  static struct cmd_node auth_node = { -	AUTH_NODE, "Password: ", +	.node = AUTH_NODE, +	.prompt = "Password: ",  };  static struct cmd_node view_node = { -	VIEW_NODE, "%s> ", +	.node = VIEW_NODE, +	.prompt = "%s> ",  };  static struct cmd_node auth_enable_node = { -	AUTH_ENABLE_NODE, "Password: ", +	.node = AUTH_ENABLE_NODE, +	.prompt = "Password: ",  };  static struct cmd_node enable_node = { -	ENABLE_NODE, "%s# ", +	.node = ENABLE_NODE, +	.prompt = "%s# ",  }; -static struct cmd_node config_node = {CONFIG_NODE, "%s(config)# ", 1}; +static struct cmd_node config_node = { +	.node = CONFIG_NODE, +	.prompt = "%s(config)# ", +	.vtysh = 1, +};  static const struct facility_map {  	int facility; diff --git a/lib/filter.c b/lib/filter.c index 3226fb2f5e..381f9829bb 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -2813,8 +2813,10 @@ static int config_write_access(struct vty *vty, afi_t afi)  }  static struct cmd_node access_mac_node = { -	ACCESS_MAC_NODE, "", /* Access list has no interface. */ -	1}; +	.node = ACCESS_MAC_NODE, +	.prompt = "", +	.vtysh = 1, +};  static int config_write_access_mac(struct vty *vty)  { @@ -2863,9 +2865,11 @@ static void access_list_init_mac(void)  }  /* Access-list node. */ -static struct cmd_node access_node = {ACCESS_NODE, -				      "", /* Access list has no interface. */ -				      1}; +static struct cmd_node access_node = { +	.node = ACCESS_NODE, +	.prompt = "", +	.vtysh = 1, +};  static int config_write_access_ipv4(struct vty *vty)  { @@ -2948,7 +2952,11 @@ static void access_list_init_ipv4(void)  	install_element(CONFIG_NODE, &no_access_list_remark_comment_cmd);  } -static struct cmd_node access_ipv6_node = {ACCESS_IPV6_NODE, "", 1}; +static struct cmd_node access_ipv6_node = { +	.node = ACCESS_IPV6_NODE, +	.prompt = "", +	.vtysh = 1, +};  static int config_write_access_ipv6(struct vty *vty)  { diff --git a/lib/keychain.c b/lib/keychain.c index ea512a2699..c0af630c4b 100644 --- a/lib/keychain.c +++ b/lib/keychain.c @@ -959,11 +959,17 @@ DEFUN (no_send_lifetime,  	return CMD_SUCCESS;  } -static struct cmd_node keychain_node = {KEYCHAIN_NODE, "%s(config-keychain)# ", -					1}; - -static struct cmd_node keychain_key_node = {KEYCHAIN_KEY_NODE, -					    "%s(config-keychain-key)# ", 1}; +static struct cmd_node keychain_node = { +	.node = KEYCHAIN_NODE, +	.prompt = "%s(config-keychain)# ", +	.vtysh = 1, +}; + +static struct cmd_node keychain_key_node = { +	.node = KEYCHAIN_KEY_NODE, +	.prompt = "%s(config-keychain-key)# ", +	.vtysh = 1, +};  static int keychain_strftime(char *buf, int bufsiz, time_t *time)  { diff --git a/lib/nexthop_group.c b/lib/nexthop_group.c index a4c823e37a..7c7914a723 100644 --- a/lib/nexthop_group.c +++ b/lib/nexthop_group.c @@ -934,9 +934,9 @@ DEFPY(ecmp_nexthops, ecmp_nexthops_cmd,  }  static struct cmd_node nexthop_group_node = { -	NH_GROUP_NODE, -	"%s(config-nh-group)# ", -	1 +	.node = NH_GROUP_NODE, +	.prompt = "%s(config-nh-group)# ", +	.vtysh = 1,  };  void nexthop_group_write_nexthop(struct vty *vty, struct nexthop *nh) diff --git a/lib/northbound_cli.c b/lib/northbound_cli.c index 17dc256281..9c001a3b08 100644 --- a/lib/northbound_cli.c +++ b/lib/northbound_cli.c @@ -1674,7 +1674,11 @@ static int nb_debug_config_write(struct vty *vty)  }  static struct debug_callbacks nb_dbg_cbs = {.debug_set_all = nb_debug_set_all}; -static struct cmd_node nb_debug_node = {NORTHBOUND_DEBUG_NODE, "", 1}; +static struct cmd_node nb_debug_node = { +	.node = NORTHBOUND_DEBUG_NODE, +	.prompt = "", +	.vtysh = 1, +};  void nb_cli_install_default(int node)  { diff --git a/lib/plist.c b/lib/plist.c index b7a020c6f7..15a79a1cdc 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -2045,9 +2045,11 @@ static void prefix_list_reset_afi(afi_t afi, int orf)  /* Prefix-list node. */ -static struct cmd_node prefix_node = {PREFIX_NODE, -				      "", /* Prefix list has no interface. */ -				      1}; +static struct cmd_node prefix_node = { +	.node = PREFIX_NODE, +	.prompt = "", +	.vtysh = 1, +};  static int config_write_prefix_ipv4(struct vty *vty)  { @@ -2109,8 +2111,10 @@ static void prefix_list_init_ipv4(void)  /* Prefix-list node. */  static struct cmd_node prefix_ipv6_node = { -	PREFIX_IPV6_NODE, "", /* Prefix list has no interface. */ -	1}; +	.node = PREFIX_IPV6_NODE, +	.prompt = "", +	.vtysh = 1, +};  static int config_write_prefix_ipv6(struct vty *vty)  { diff --git a/lib/resolver.c b/lib/resolver.c index 1be47bd6e1..83e2f52690 100644 --- a/lib/resolver.c +++ b/lib/resolver.c @@ -245,7 +245,11 @@ DEFUN(debug_resolver,  	return CMD_SUCCESS;  } -static struct cmd_node resolver_debug_node = {RESOLVER_DEBUG_NODE, "", 1}; +static struct cmd_node resolver_debug_node = { +	.node = RESOLVER_DEBUG_NODE, +	.prompt = "", +	.vtysh = 1, +};  static int resolver_config_write_debug(struct vty *vty)  { diff --git a/lib/routemap.c b/lib/routemap.c index e2baa36f24..dc73b1e0d1 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -3015,7 +3015,11 @@ DEFUN (no_debug_rmap,  }  /* Debug node. */ -static struct cmd_node rmap_debug_node = {RMAP_DEBUG_NODE, "", 1}; +static struct cmd_node rmap_debug_node = { +	.node = RMAP_DEBUG_NODE, +	.prompt = "", +	.vtysh = 1, +};  /* Configuration write function. */  static int rmap_config_write_debug(struct vty *vty) diff --git a/lib/routemap_cli.c b/lib/routemap_cli.c index 41e8cacd81..b7db1d4dd5 100644 --- a/lib/routemap_cli.c +++ b/lib/routemap_cli.c @@ -1064,7 +1064,11 @@ static int route_map_config_write(struct vty *vty)  }  /* Route map node structure. */ -static struct cmd_node rmap_node = {RMAP_NODE, "%s(config-route-map)# ", 1}; +static struct cmd_node rmap_node = { +	.node = RMAP_NODE, +	.prompt = "%s(config-route-map)# ", +	.vtysh = 1, +};  static void rmap_autocomplete(vector comps, struct cmd_token *token)  { @@ -758,7 +758,11 @@ DEFUN (no_vrf,  } -static struct cmd_node vrf_node = {VRF_NODE, "%s(config-vrf)# ", 1}; +static struct cmd_node vrf_node = { +	.node = VRF_NODE, +	.prompt = "%s(config-vrf)# ", +	.vtysh = 1, +};  DEFUN_NOSH (vrf_netns,         vrf_netns_cmd, @@ -848,7 +852,11 @@ static int vrf_write_host(struct vty *vty)  	return 1;  } -static struct cmd_node vrf_debug_node = {VRF_DEBUG_NODE, "", 1}; +static struct cmd_node vrf_debug_node = { +	.node = VRF_DEBUG_NODE, +	.prompt = "", +	.vtysh = 1, +};  void vrf_install_commands(void)  { @@ -2990,7 +2990,9 @@ static int vty_config_write(struct vty *vty)  }  struct cmd_node vty_node = { -	VTY_NODE, "%s(config-line)# ", 1, +	.node = VTY_NODE, +	.prompt = "%s(config-line)# ", +	.vtysh = 1,  };  /* Reset all VTY status. */  | 
