]> git.puffer.fish Git - matthieu/frr.git/commitdiff
Merge pull request #6135 from opensourcerouting/cli-node-cleanup
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 16 Apr 2020 23:24:56 +0000 (19:24 -0400)
committerGitHub <noreply@github.com>
Thu, 16 Apr 2020 23:24:56 +0000 (19:24 -0400)
*: clean up the mess that is CLI command nodes

1  2 
lib/command.c
lib/command.h
lib/plist.c
vtysh/vtysh.c

diff --cc lib/command.c
index be8f1e72a36f0feddb16e21fd49c9b21350259ce,d51922dfa18cc484808731d3b9279d712d4cf83c..7abca5e70d907003df75e932d977d7c4e477c19b
@@@ -193,11 -122,81 +122,22 @@@ static struct cmd_node auth_enable_nod
  };
  
  static struct cmd_node enable_node = {
-       ENABLE_NODE, "%s# ",
+       .name = "enable",
+       .node = ENABLE_NODE,
+       .prompt = "%s# ",
+       .node_exit = root_on_exit,
  };
  
- static struct cmd_node config_node = {CONFIG_NODE, "%s(config)# ", 1};
+ static int config_write_host(struct vty *vty);
+ static struct cmd_node config_node = {
+       .name = "config",
+       .node = CONFIG_NODE,
+       .parent_node = ENABLE_NODE,
+       .prompt = "%s(config)# ",
+       .config_write = config_write_host,
+       .node_exit = vty_config_node_exit,
+ };
  
 -static const struct facility_map {
 -      int facility;
 -      const char *name;
 -      size_t match;
 -} syslog_facilities[] = {
 -      {LOG_KERN, "kern", 1},
 -      {LOG_USER, "user", 2},
 -      {LOG_MAIL, "mail", 1},
 -      {LOG_DAEMON, "daemon", 1},
 -      {LOG_AUTH, "auth", 1},
 -      {LOG_SYSLOG, "syslog", 1},
 -      {LOG_LPR, "lpr", 2},
 -      {LOG_NEWS, "news", 1},
 -      {LOG_UUCP, "uucp", 2},
 -      {LOG_CRON, "cron", 1},
 -#ifdef LOG_FTP
 -      {LOG_FTP, "ftp", 1},
 -#endif
 -      {LOG_LOCAL0, "local0", 6},
 -      {LOG_LOCAL1, "local1", 6},
 -      {LOG_LOCAL2, "local2", 6},
 -      {LOG_LOCAL3, "local3", 6},
 -      {LOG_LOCAL4, "local4", 6},
 -      {LOG_LOCAL5, "local5", 6},
 -      {LOG_LOCAL6, "local6", 6},
 -      {LOG_LOCAL7, "local7", 6},
 -      {0, NULL, 0},
 -};
 -
 -static const char *facility_name(int facility)
 -{
 -      const struct facility_map *fm;
 -
 -      for (fm = syslog_facilities; fm->name; fm++)
 -              if (fm->facility == facility)
 -                      return fm->name;
 -      return "";
 -}
 -
 -static int facility_match(const char *str)
 -{
 -      const struct facility_map *fm;
 -
 -      for (fm = syslog_facilities; fm->name; fm++)
 -              if (!strncmp(str, fm->name, fm->match))
 -                      return fm->facility;
 -      return -1;
 -}
 -
 -static int level_match(const char *s)
 -{
 -      int level;
 -
 -      for (level = 0; zlog_priority[level] != NULL; level++)
 -              if (!strncmp(s, zlog_priority[level], 2))
 -                      return level;
 -      return ZLOG_DISABLED;
 -}
 -
  /* This is called from main when a daemon is invoked with -v or --version. */
  void print_version(const char *progname)
  {
diff --cc lib/command.h
Simple merge
diff --cc lib/plist.c
Simple merge
diff --cc vtysh/vtysh.c
Simple merge