diff options
author | whitespace / reindent <invalid@invalid.invalid> | 2017-07-17 14:03:14 +0200 |
---|---|---|
committer | whitespace / reindent <invalid@invalid.invalid> | 2017-07-17 14:04:07 +0200 |
commit | d62a17aedeb0eebdba98238874bb13d62c48dbf9 (patch) | |
tree | 3b319b1d61c8b85b4d1f06adf8b844bb8a9b5107 /lib/command.h | |
parent | *: add indent control files (diff) | |
download | frr-d62a17aedeb0eebdba98238874bb13d62c48dbf9.tar.xz frr-d62a17aedeb0eebdba98238874bb13d62c48dbf9.zip |
*: reindentreindent-master-after
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'`
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/command.h')
-rw-r--r-- | lib/command.h | 443 |
1 files changed, 227 insertions, 216 deletions
diff --git a/lib/command.h b/lib/command.h index 4c2c5716b..5d52fe3fc 100644 --- a/lib/command.h +++ b/lib/command.h @@ -37,132 +37,129 @@ DECLARE_MTYPE(COMPLETION) DECLARE_MTYPE(STRVEC) /* Host configuration variable */ -struct host -{ - /* Host name of this router. */ - char *name; +struct host { + /* Host name of this router. */ + char *name; - /* Password for vty interface. */ - char *password; - char *password_encrypt; + /* Password for vty interface. */ + char *password; + char *password_encrypt; - /* Enable password */ - char *enable; - char *enable_encrypt; + /* Enable password */ + char *enable; + char *enable_encrypt; - /* System wide terminal lines. */ - int lines; + /* System wide terminal lines. */ + int lines; - /* Log filename. */ - char *logfile; + /* Log filename. */ + char *logfile; - /* config file name of this host */ - char *config; - int noconfig; + /* config file name of this host */ + char *config; + int noconfig; - /* Flags for services */ - int advanced; - int encrypt; + /* Flags for services */ + int advanced; + int encrypt; - /* Banner configuration. */ - const char *motd; - char *motdfile; + /* Banner configuration. */ + const char *motd; + char *motdfile; }; /* There are some command levels which called from command node. */ -enum node_type -{ - AUTH_NODE, /* Authentication mode of vty interface. */ - VIEW_NODE, /* View node. Default mode of vty interface. */ - AUTH_ENABLE_NODE, /* Authentication mode for change enable. */ - ENABLE_NODE, /* Enable node. */ - CONFIG_NODE, /* Config node. Default mode of config file. */ - SERVICE_NODE, /* Service node. */ - DEBUG_NODE, /* Debug node. */ - VRF_DEBUG_NODE, /* Vrf Debug node. */ - DEBUG_VNC_NODE, /* Debug VNC node. */ - AAA_NODE, /* AAA node. */ - KEYCHAIN_NODE, /* Key-chain node. */ - KEYCHAIN_KEY_NODE, /* Key-chain key node. */ - NS_NODE, /* Logical-Router node. */ - VRF_NODE, /* VRF mode node. */ - INTERFACE_NODE, /* Interface mode node. */ - ZEBRA_NODE, /* zebra connection node. */ - TABLE_NODE, /* rtm_table selection node. */ - RIP_NODE, /* RIP protocol mode node. */ - RIPNG_NODE, /* RIPng protocol mode node. */ - BABEL_NODE, /* BABEL protocol mode node. */ - EIGRP_NODE, /* EIGRP protocol mode node. */ - BGP_NODE, /* BGP protocol mode which includes BGP4+ */ - BGP_VPNV4_NODE, /* BGP MPLS-VPN PE exchange. */ - BGP_VPNV6_NODE, /* BGP MPLS-VPN PE exchange. */ - BGP_IPV4_NODE, /* BGP IPv4 unicast address family. */ - BGP_IPV4M_NODE, /* BGP IPv4 multicast address family. */ - BGP_IPV4L_NODE, /* BGP IPv4 labeled unicast address family. */ - BGP_IPV6_NODE, /* BGP IPv6 address family */ - BGP_IPV6M_NODE, /* BGP IPv6 multicast address family. */ - BGP_IPV6L_NODE, /* BGP IPv6 labeled unicast address family. */ - BGP_VRF_POLICY_NODE, /* BGP VRF policy */ - BGP_VNC_DEFAULTS_NODE, /* BGP VNC nve defaults */ - BGP_VNC_NVE_GROUP_NODE, /* BGP VNC nve group */ - BGP_VNC_L2_GROUP_NODE, /* BGP VNC L2 group */ - RFP_DEFAULTS_NODE, /* RFP defaults node */ - BGP_EVPN_NODE, /* BGP EVPN node. */ - OSPF_NODE, /* OSPF protocol mode */ - OSPF6_NODE, /* OSPF protocol for IPv6 mode */ - LDP_NODE, /* LDP protocol mode */ - LDP_IPV4_NODE, /* LDP IPv4 address family */ - LDP_IPV6_NODE, /* LDP IPv6 address family */ - LDP_IPV4_IFACE_NODE, /* LDP IPv4 Interface */ - LDP_IPV6_IFACE_NODE, /* LDP IPv6 Interface */ - LDP_L2VPN_NODE, /* LDP L2VPN node */ - LDP_PSEUDOWIRE_NODE, /* LDP Pseudowire node */ - ISIS_NODE, /* ISIS protocol mode */ - PIM_NODE, /* PIM protocol mode */ - MASC_NODE, /* MASC for multicast. */ - IRDP_NODE, /* ICMP Router Discovery Protocol mode. */ - IP_NODE, /* Static ip route node. */ - ACCESS_NODE, /* Access list node. */ - PREFIX_NODE, /* Prefix list node. */ - ACCESS_IPV6_NODE, /* Access list node. */ - PREFIX_IPV6_NODE, /* Prefix list node. */ - AS_LIST_NODE, /* AS list node. */ - COMMUNITY_LIST_NODE, /* Community list node. */ - RMAP_NODE, /* Route map node. */ - SMUX_NODE, /* SNMP configuration node. */ - DUMP_NODE, /* Packet dump node. */ - FORWARDING_NODE, /* IP forwarding node. */ - PROTOCOL_NODE, /* protocol filtering node */ - MPLS_NODE, /* MPLS config node */ - VTY_NODE, /* Vty node. */ - LINK_PARAMS_NODE, /* Link-parameters node */ - BGP_EVPN_VNI_NODE, /* BGP EVPN VNI */ +enum node_type { + AUTH_NODE, /* Authentication mode of vty interface. */ + VIEW_NODE, /* View node. Default mode of vty interface. */ + AUTH_ENABLE_NODE, /* Authentication mode for change enable. */ + ENABLE_NODE, /* Enable node. */ + CONFIG_NODE, /* Config node. Default mode of config file. */ + SERVICE_NODE, /* Service node. */ + DEBUG_NODE, /* Debug node. */ + VRF_DEBUG_NODE, /* Vrf Debug node. */ + DEBUG_VNC_NODE, /* Debug VNC node. */ + AAA_NODE, /* AAA node. */ + KEYCHAIN_NODE, /* Key-chain node. */ + KEYCHAIN_KEY_NODE, /* Key-chain key node. */ + NS_NODE, /* Logical-Router node. */ + VRF_NODE, /* VRF mode node. */ + INTERFACE_NODE, /* Interface mode node. */ + ZEBRA_NODE, /* zebra connection node. */ + TABLE_NODE, /* rtm_table selection node. */ + RIP_NODE, /* RIP protocol mode node. */ + RIPNG_NODE, /* RIPng protocol mode node. */ + BABEL_NODE, /* BABEL protocol mode node. */ + EIGRP_NODE, /* EIGRP protocol mode node. */ + BGP_NODE, /* BGP protocol mode which includes BGP4+ */ + BGP_VPNV4_NODE, /* BGP MPLS-VPN PE exchange. */ + BGP_VPNV6_NODE, /* BGP MPLS-VPN PE exchange. */ + BGP_IPV4_NODE, /* BGP IPv4 unicast address family. */ + BGP_IPV4M_NODE, /* BGP IPv4 multicast address family. */ + BGP_IPV4L_NODE, /* BGP IPv4 labeled unicast address family. */ + BGP_IPV6_NODE, /* BGP IPv6 address family */ + BGP_IPV6M_NODE, /* BGP IPv6 multicast address family. */ + BGP_IPV6L_NODE, /* BGP IPv6 labeled unicast address family. */ + BGP_VRF_POLICY_NODE, /* BGP VRF policy */ + BGP_VNC_DEFAULTS_NODE, /* BGP VNC nve defaults */ + BGP_VNC_NVE_GROUP_NODE, /* BGP VNC nve group */ + BGP_VNC_L2_GROUP_NODE, /* BGP VNC L2 group */ + RFP_DEFAULTS_NODE, /* RFP defaults node */ + BGP_EVPN_NODE, /* BGP EVPN node. */ + OSPF_NODE, /* OSPF protocol mode */ + OSPF6_NODE, /* OSPF protocol for IPv6 mode */ + LDP_NODE, /* LDP protocol mode */ + LDP_IPV4_NODE, /* LDP IPv4 address family */ + LDP_IPV6_NODE, /* LDP IPv6 address family */ + LDP_IPV4_IFACE_NODE, /* LDP IPv4 Interface */ + LDP_IPV6_IFACE_NODE, /* LDP IPv6 Interface */ + LDP_L2VPN_NODE, /* LDP L2VPN node */ + LDP_PSEUDOWIRE_NODE, /* LDP Pseudowire node */ + ISIS_NODE, /* ISIS protocol mode */ + PIM_NODE, /* PIM protocol mode */ + MASC_NODE, /* MASC for multicast. */ + IRDP_NODE, /* ICMP Router Discovery Protocol mode. */ + IP_NODE, /* Static ip route node. */ + ACCESS_NODE, /* Access list node. */ + PREFIX_NODE, /* Prefix list node. */ + ACCESS_IPV6_NODE, /* Access list node. */ + PREFIX_IPV6_NODE, /* Prefix list node. */ + AS_LIST_NODE, /* AS list node. */ + COMMUNITY_LIST_NODE, /* Community list node. */ + RMAP_NODE, /* Route map node. */ + SMUX_NODE, /* SNMP configuration node. */ + DUMP_NODE, /* Packet dump node. */ + FORWARDING_NODE, /* IP forwarding node. */ + PROTOCOL_NODE, /* protocol filtering node */ + MPLS_NODE, /* MPLS config node */ + VTY_NODE, /* Vty node. */ + LINK_PARAMS_NODE, /* Link-parameters node */ + BGP_EVPN_VNI_NODE, /* BGP EVPN VNI */ }; /* Node which has some commands and prompt string and configuration function pointer . */ -struct cmd_node -{ - /* Node index. */ - enum node_type node; +struct cmd_node { + /* Node index. */ + enum node_type node; - /* Prompt character at vty interface. */ - const char *prompt; + /* Prompt character at vty interface. */ + const char *prompt; - /* Is this node's configuration goes to vtysh ? */ - int vtysh; + /* Is this node's configuration goes to vtysh ? */ + int vtysh; - /* Node's configuration write function */ - int (*func) (struct vty *); + /* Node's configuration write function */ + int (*func)(struct vty *); - /* Node's command graph */ - struct graph *cmdgraph; + /* Node's command graph */ + struct graph *cmdgraph; - /* Vector of this node's command list. */ - vector cmd_vector; + /* Vector of this node's command list. */ + vector cmd_vector; - /* Hashed index of command node list, for de-dupping primarily */ - struct hash *cmd_hash; + /* Hashed index of command node list, for de-dupping primarily */ + struct hash *cmd_hash; }; /* Return value of the commands. */ @@ -188,101 +185,108 @@ struct cmd_node #ifndef VTYSH_EXTRACT_PL /* helper defines for end-user DEFUN* macros */ -#define DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attrs, dnum) \ - static struct cmd_element cmdname = \ - { \ - .string = cmdstr, \ - .func = funcname, \ - .doc = helpstr, \ - .attr = attrs, \ - .daemon = dnum, \ - .name = #cmdname, \ - }; - -#define DEFUN_CMD_FUNC_DECL(funcname) \ - static int funcname (const struct cmd_element *, struct vty *, int, struct cmd_token *[]); - -#define DEFUN_CMD_FUNC_TEXT(funcname) \ - static int funcname \ - (const struct cmd_element *self __attribute__ ((unused)), \ - struct vty *vty __attribute__ ((unused)), \ - int argc __attribute__ ((unused)), \ - struct cmd_token *argv[] __attribute__ ((unused)) ) - -#define DEFPY(funcname, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) \ - funcdecl_##funcname - -#define DEFUN(funcname, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_FUNC_DECL(funcname) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) \ - DEFUN_CMD_FUNC_TEXT(funcname) - -#define DEFUN_ATTR(funcname, cmdname, cmdstr, helpstr, attr) \ - DEFUN_CMD_FUNC_DECL(funcname) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, 0) \ - DEFUN_CMD_FUNC_TEXT(funcname) - -#define DEFUN_HIDDEN(funcname, cmdname, cmdstr, helpstr) \ - DEFUN_ATTR (funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN) - -#define DEFUN_DEPRECATED(funcname, cmdname, cmdstr, helpstr) \ - DEFUN_ATTR (funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED) \ +#define DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attrs, dnum) \ + static struct cmd_element cmdname = { \ + .string = cmdstr, \ + .func = funcname, \ + .doc = helpstr, \ + .attr = attrs, \ + .daemon = dnum, \ + .name = #cmdname, \ + }; + +#define DEFUN_CMD_FUNC_DECL(funcname) \ + static int funcname(const struct cmd_element *, struct vty *, int, \ + struct cmd_token *[]); + +#define DEFUN_CMD_FUNC_TEXT(funcname) \ + static int funcname(const struct cmd_element *self \ + __attribute__((unused)), \ + struct vty *vty __attribute__((unused)), \ + int argc __attribute__((unused)), \ + struct cmd_token *argv[] __attribute__((unused))) + +#define DEFPY(funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) \ + funcdecl_##funcname + +#define DEFUN(funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_FUNC_DECL(funcname) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) \ + DEFUN_CMD_FUNC_TEXT(funcname) + +#define DEFUN_ATTR(funcname, cmdname, cmdstr, helpstr, attr) \ + DEFUN_CMD_FUNC_DECL(funcname) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, 0) \ + DEFUN_CMD_FUNC_TEXT(funcname) + +#define DEFUN_HIDDEN(funcname, cmdname, cmdstr, helpstr) \ + DEFUN_ATTR(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN) + +#define DEFUN_DEPRECATED(funcname, cmdname, cmdstr, helpstr) \ + DEFUN_ATTR(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED) /* DEFUN_NOSH for commands that vtysh should ignore */ -#define DEFUN_NOSH(funcname, cmdname, cmdstr, helpstr) \ - DEFUN(funcname, cmdname, cmdstr, helpstr) +#define DEFUN_NOSH(funcname, cmdname, cmdstr, helpstr) \ + DEFUN(funcname, cmdname, cmdstr, helpstr) /* DEFSH for vtysh. */ -#define DEFSH(daemon, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_ELEMENT(NULL, cmdname, cmdstr, helpstr, 0, daemon) \ +#define DEFSH(daemon, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(NULL, cmdname, cmdstr, helpstr, 0, daemon) -#define DEFSH_HIDDEN(daemon, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_ELEMENT(NULL, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, daemon) \ +#define DEFSH_HIDDEN(daemon, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(NULL, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, \ + daemon) /* DEFUN + DEFSH */ -#define DEFUNSH(daemon, funcname, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_FUNC_DECL(funcname) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, daemon) \ - DEFUN_CMD_FUNC_TEXT(funcname) +#define DEFUNSH(daemon, funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_FUNC_DECL(funcname) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, daemon) \ + DEFUN_CMD_FUNC_TEXT(funcname) /* DEFUN + DEFSH with attributes */ -#define DEFUNSH_ATTR(daemon, funcname, cmdname, cmdstr, helpstr, attr) \ - DEFUN_CMD_FUNC_DECL(funcname) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, daemon) \ - DEFUN_CMD_FUNC_TEXT(funcname) +#define DEFUNSH_ATTR(daemon, funcname, cmdname, cmdstr, helpstr, attr) \ + DEFUN_CMD_FUNC_DECL(funcname) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, daemon) \ + DEFUN_CMD_FUNC_TEXT(funcname) -#define DEFUNSH_HIDDEN(daemon, funcname, cmdname, cmdstr, helpstr) \ - DEFUNSH_ATTR (daemon, funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN) +#define DEFUNSH_HIDDEN(daemon, funcname, cmdname, cmdstr, helpstr) \ + DEFUNSH_ATTR(daemon, funcname, cmdname, cmdstr, helpstr, \ + CMD_ATTR_HIDDEN) -#define DEFUNSH_DEPRECATED(daemon, funcname, cmdname, cmdstr, helpstr) \ - DEFUNSH_ATTR (daemon, funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED) +#define DEFUNSH_DEPRECATED(daemon, funcname, cmdname, cmdstr, helpstr) \ + DEFUNSH_ATTR(daemon, funcname, cmdname, cmdstr, helpstr, \ + CMD_ATTR_DEPRECATED) /* ALIAS macro which define existing command's alias. */ -#define ALIAS(funcname, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) +#define ALIAS(funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) -#define ALIAS_ATTR(funcname, cmdname, cmdstr, helpstr, attr) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, 0) +#define ALIAS_ATTR(funcname, cmdname, cmdstr, helpstr, attr) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, 0) -#define ALIAS_HIDDEN(funcname, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, 0) +#define ALIAS_HIDDEN(funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, \ + 0) -#define ALIAS_DEPRECATED(funcname, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED, 0) +#define ALIAS_DEPRECATED(funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, \ + CMD_ATTR_DEPRECATED, 0) -#define ALIAS_SH(daemon, funcname, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, daemon) +#define ALIAS_SH(daemon, funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, daemon) -#define ALIAS_SH_HIDDEN(daemon, funcname, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, daemon) +#define ALIAS_SH_HIDDEN(daemon, funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, \ + daemon) -#define ALIAS_SH_DEPRECATED(daemon, funcname, cmdname, cmdstr, helpstr) \ - DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED, daemon) +#define ALIAS_SH_DEPRECATED(daemon, funcname, cmdname, cmdstr, helpstr) \ + DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, \ + CMD_ATTR_DEPRECATED, daemon) #else /* VTYSH_EXTRACT_PL */ -#define DEFPY(funcname, cmdname, cmdstr, helpstr) \ - DEFUN(funcname, cmdname, cmdstr, helpstr) +#define DEFPY(funcname, cmdname, cmdstr, helpstr) \ + DEFUN(funcname, cmdname, cmdstr, helpstr) #endif /* VTYSH_EXTRACT_PL */ /* Some macroes */ @@ -332,8 +336,8 @@ struct cmd_node #define SECONDS_STR "Seconds\n" #define ROUTE_STR "Routing Table\n" #define PREFIX_LIST_STR "Build a prefix list\n" -#define OSPF6_DUMP_TYPE_LIST \ -"<neighbor|interface|area|lsa|zebra|config|dbex|spf|route|lsdb|redistribute|hook|asbr|prefix|abr>" +#define OSPF6_DUMP_TYPE_LIST \ + "<neighbor|interface|area|lsa|zebra|config|dbex|spf|route|lsdb|redistribute|hook|asbr|prefix|abr>" #define ISIS_STR "IS-IS information\n" #define AREA_TAG_STR "[area tag]\n" #define COMMUNITY_AANN_STR "Community number where AA and NN are (0-65535)\n" @@ -353,60 +357,67 @@ struct cmd_node #define NEIGHBOR_ADDR_STR3 "Neighbor address\nIPv6 address\nInterface name\n" /* Prototypes. */ -extern void install_node (struct cmd_node *, int (*) (struct vty *)); -extern void install_default (enum node_type); -extern void install_element (enum node_type, struct cmd_element *); +extern void install_node(struct cmd_node *, int (*)(struct vty *)); +extern void install_default(enum node_type); +extern void install_element(enum node_type, struct cmd_element *); /* known issue with uninstall_element: changes to cmd_token->attr (i.e. * deprecated/hidden) are not reversed. */ -extern void uninstall_element (enum node_type, struct cmd_element *); +extern void uninstall_element(enum node_type, struct cmd_element *); /* Concatenates argv[shift] through argv[argc-1] into a single NUL-terminated string with a space between each element (allocated using XMALLOC(MTYPE_TMP)). Returns NULL if shift >= argc. */ -extern char *argv_concat (struct cmd_token **argv, int argc, int shift); -extern int argv_find (struct cmd_token **argv, int argc, const char *text, int *index); - -extern vector cmd_make_strvec (const char *); -extern void cmd_free_strvec (vector); -extern vector cmd_describe_command (vector, struct vty *, int *status); -extern char **cmd_complete_command (vector, struct vty *, int *status); -extern const char *cmd_prompt (enum node_type); -extern int command_config_read_one_line (struct vty *vty, const struct cmd_element **, int use_config_node); -extern int config_from_file (struct vty *, FILE *, unsigned int *line_num); -extern enum node_type node_parent (enum node_type); -extern int cmd_execute_command (vector, struct vty *, const struct cmd_element **, int); -extern int cmd_execute_command_strict (vector, struct vty *, const struct cmd_element **); -extern void cmd_init (int); -extern void cmd_terminate (void); -extern void cmd_exit (struct vty *vty); -extern int cmd_list_cmds (struct vty *vty, int do_permute); - -extern int cmd_hostname_set (const char *hostname); +extern char *argv_concat(struct cmd_token **argv, int argc, int shift); +extern int argv_find(struct cmd_token **argv, int argc, const char *text, + int *index); + +extern vector cmd_make_strvec(const char *); +extern void cmd_free_strvec(vector); +extern vector cmd_describe_command(vector, struct vty *, int *status); +extern char **cmd_complete_command(vector, struct vty *, int *status); +extern const char *cmd_prompt(enum node_type); +extern int command_config_read_one_line(struct vty *vty, + const struct cmd_element **, + int use_config_node); +extern int config_from_file(struct vty *, FILE *, unsigned int *line_num); +extern enum node_type node_parent(enum node_type); +extern int cmd_execute_command(vector, struct vty *, + const struct cmd_element **, int); +extern int cmd_execute_command_strict(vector, struct vty *, + const struct cmd_element **); +extern void cmd_init(int); +extern void cmd_terminate(void); +extern void cmd_exit(struct vty *vty); +extern int cmd_list_cmds(struct vty *vty, int do_permute); + +extern int cmd_hostname_set(const char *hostname); /* NOT safe for general use; call this only if DEV_BUILD! */ -extern void grammar_sandbox_init (void); +extern void grammar_sandbox_init(void); -extern vector completions_to_vec (struct list *completions); +extern vector completions_to_vec(struct list *completions); /* Export typical functions. */ -extern const char *host_config_get (void); -extern void host_config_set (const char *); +extern const char *host_config_get(void); +extern void host_config_set(const char *); -extern void print_version (const char *); +extern void print_version(const char *); -extern int cmd_banner_motd_file (const char *); +extern int cmd_banner_motd_file(const char *); /* struct host global, ick */ extern struct host host; struct cmd_variable_handler { - const char *tokenname, *varname; - void (*completions)(vector out, struct cmd_token *token); + const char *tokenname, *varname; + void (*completions)(vector out, struct cmd_token *token); }; -extern void cmd_variable_complete (struct cmd_token *token, const char *arg, vector comps); -extern void cmd_variable_handler_register (const struct cmd_variable_handler *cvh); -extern char *cmd_variable_comp2str (vector comps, unsigned short cols); +extern void cmd_variable_complete(struct cmd_token *token, const char *arg, + vector comps); +extern void +cmd_variable_handler_register(const struct cmd_variable_handler *cvh); +extern char *cmd_variable_comp2str(vector comps, unsigned short cols); #endif /* _ZEBRA_COMMAND_H */ |