diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2017-06-21 03:10:57 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2017-06-29 17:31:28 +0000 |
| commit | 96ade3ed7716c89b8047a1c0ab3377985d461cf8 (patch) | |
| tree | 1c3061738c2c0027612b6cdb3e5d5eccb08587bf /lib | |
| parent | 4d5f445750e01467898eee47796e80d808500d56 (diff) | |
*: use vty_outln
Saves 400 lines
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/agentx.c | 6 | ||||
| -rw-r--r-- | lib/bfd.c | 16 | ||||
| -rw-r--r-- | lib/command.c | 156 | ||||
| -rw-r--r-- | lib/distribute.c | 28 | ||||
| -rw-r--r-- | lib/filter.c | 73 | ||||
| -rw-r--r-- | lib/grammar_sandbox.c | 52 | ||||
| -rw-r--r-- | lib/if.c | 8 | ||||
| -rw-r--r-- | lib/if_rmap.c | 16 | ||||
| -rw-r--r-- | lib/keychain.c | 26 | ||||
| -rw-r--r-- | lib/memory_vty.c | 71 | ||||
| -rw-r--r-- | lib/ns.c | 10 | ||||
| -rw-r--r-- | lib/plist.c | 88 | ||||
| -rw-r--r-- | lib/routemap.c | 112 | ||||
| -rw-r--r-- | lib/skiplist.c | 7 | ||||
| -rw-r--r-- | lib/smux.c | 2 | ||||
| -rw-r--r-- | lib/spf_backoff.c | 46 | ||||
| -rw-r--r-- | lib/thread.c | 22 | ||||
| -rw-r--r-- | lib/vrf.c | 2 | ||||
| -rw-r--r-- | lib/vty.c | 115 | ||||
| -rw-r--r-- | lib/workqueue.c | 19 |
20 files changed, 412 insertions, 463 deletions
diff --git a/lib/agentx.c b/lib/agentx.c index fda634bb86..08cd650153 100644 --- a/lib/agentx.c +++ b/lib/agentx.c @@ -168,7 +168,7 @@ static int config_write_agentx (struct vty *vty) { if (agentx_enabled) - vty_out (vty, "agentx%s", VTY_NEWLINE); + vty_outln (vty, "agentx"); return 1; } @@ -186,7 +186,7 @@ DEFUN (agentx_enable, agentx_enabled = 1; return CMD_SUCCESS; } - vty_out (vty, "SNMP AgentX already enabled%s", VTY_NEWLINE); + vty_outln (vty, "SNMP AgentX already enabled"); return CMD_SUCCESS; } @@ -198,7 +198,7 @@ DEFUN (no_agentx, "SNMP AgentX settings\n") { if (!agentx_enabled) return CMD_SUCCESS; - vty_out (vty, "SNMP AgentX support cannot be disabled once enabled%s", VTY_NEWLINE); + vty_outln (vty, "SNMP AgentX support cannot be disabled once enabled"); return CMD_WARNING; } @@ -394,11 +394,11 @@ bfd_show_param(struct vty *vty, struct bfd_info *bfd_info, int bfd_tag, } else { - vty_out (vty, " %s%sDetect Mul: %d, Min Rx interval: %d," - " Min Tx interval: %d%s", + vty_outln (vty, " %s%sDetect Mul: %d, Min Rx interval: %d," + " Min Tx interval: %d", (extra_space) ? " ": "", (bfd_tag) ? "BFD: " : " ", bfd_info->detect_mult, bfd_info->required_min_rx, - bfd_info->desired_min_tx, VTY_NEWLINE); + bfd_info->desired_min_tx); } } @@ -423,9 +423,9 @@ bfd_show_status(struct vty *vty, struct bfd_info *bfd_info, int bfd_tag, } else { - vty_out (vty, " %s%sStatus: %s, Last update: %s%s", + vty_outln (vty, " %s%sStatus: %s, Last update: %s", (extra_space) ? " ": "", (bfd_tag) ? "BFD: " : " ", - bfd_get_status_str(bfd_info->status), time_buf, VTY_NEWLINE); + bfd_get_status_str(bfd_info->status), time_buf); } } @@ -451,8 +451,8 @@ bfd_show_info(struct vty *vty, struct bfd_info *bfd_info, int multihop, } else { - vty_out (vty, " %sBFD: Type: %s%s", (extra_space) ? " " : "", - (multihop) ? "multi hop" : "single hop", VTY_NEWLINE); + vty_outln (vty, " %sBFD: Type: %s", (extra_space) ? " " : "", + (multihop) ? "multi hop" : "single hop"); } bfd_show_param(vty, bfd_info, 0, extra_space, use_json, json_bfd); @@ -461,7 +461,7 @@ bfd_show_info(struct vty *vty, struct bfd_info *bfd_info, int multihop, if (use_json) json_object_object_add(json_obj, "peerBfdInfo", json_bfd); else - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); } /* diff --git a/lib/command.c b/lib/command.c index 2c022a0db7..574e7e0b4a 100644 --- a/lib/command.c +++ b/lib/command.c @@ -433,29 +433,28 @@ static int config_write_host (struct vty *vty) { if (host.name) - vty_out (vty, "hostname %s%s", host.name, VTY_NEWLINE); + vty_outln (vty, "hostname %s", host.name); if (host.encrypt) { if (host.password_encrypt) - vty_out (vty, "password 8 %s%s", host.password_encrypt, VTY_NEWLINE); + vty_outln (vty, "password 8 %s", host.password_encrypt); if (host.enable_encrypt) - vty_out (vty, "enable password 8 %s%s", host.enable_encrypt, VTY_NEWLINE); + vty_outln (vty, "enable password 8 %s", host.enable_encrypt); } else { if (host.password) - vty_out (vty, "password %s%s", host.password, VTY_NEWLINE); + vty_outln (vty, "password %s", host.password); if (host.enable) - vty_out (vty, "enable password %s%s", host.enable, VTY_NEWLINE); + vty_outln (vty, "enable password %s", host.enable); } if (zlog_default->default_lvl != LOG_DEBUG) { - vty_out (vty, "! N.B. The 'log trap' command is deprecated.%s", - VTY_NEWLINE); - vty_out (vty, "log trap %s%s", - zlog_priority[zlog_default->default_lvl], VTY_NEWLINE); + vty_outln (vty,"! N.B. The 'log trap' command is deprecated."); + vty_outln (vty, "log trap %s", + zlog_priority[zlog_default->default_lvl]); } if (host.logfile && (zlog_default->maxlvl[ZLOG_DEST_FILE] != ZLOG_DISABLED)) @@ -464,7 +463,7 @@ config_write_host (struct vty *vty) if (zlog_default->maxlvl[ZLOG_DEST_FILE] != zlog_default->default_lvl) vty_out (vty, " %s", zlog_priority[zlog_default->maxlvl[ZLOG_DEST_FILE]]); - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); } if (zlog_default->maxlvl[ZLOG_DEST_STDOUT] != ZLOG_DISABLED) @@ -473,14 +472,14 @@ config_write_host (struct vty *vty) if (zlog_default->maxlvl[ZLOG_DEST_STDOUT] != zlog_default->default_lvl) vty_out (vty, " %s", zlog_priority[zlog_default->maxlvl[ZLOG_DEST_STDOUT]]); - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); } if (zlog_default->maxlvl[ZLOG_DEST_MONITOR] == ZLOG_DISABLED) - vty_out(vty,"no log monitor%s",VTY_NEWLINE); + vty_outln (vty,"no log monitor"); else if (zlog_default->maxlvl[ZLOG_DEST_MONITOR] != zlog_default->default_lvl) - vty_out(vty,"log monitor %s%s", - zlog_priority[zlog_default->maxlvl[ZLOG_DEST_MONITOR]],VTY_NEWLINE); + vty_outln (vty,"log monitor %s", + zlog_priority[zlog_default->maxlvl[ZLOG_DEST_MONITOR]]); if (zlog_default->maxlvl[ZLOG_DEST_SYSLOG] != ZLOG_DISABLED) { @@ -488,34 +487,33 @@ config_write_host (struct vty *vty) if (zlog_default->maxlvl[ZLOG_DEST_SYSLOG] != zlog_default->default_lvl) vty_out (vty, " %s", zlog_priority[zlog_default->maxlvl[ZLOG_DEST_SYSLOG]]); - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); } if (zlog_default->facility != LOG_DAEMON) - vty_out (vty, "log facility %s%s", - facility_name(zlog_default->facility), VTY_NEWLINE); + vty_outln (vty, "log facility %s", + facility_name(zlog_default->facility)); if (zlog_default->record_priority == 1) - vty_out (vty, "log record-priority%s", VTY_NEWLINE); + vty_outln (vty, "log record-priority"); if (zlog_default->timestamp_precision > 0) - vty_out (vty, "log timestamp precision %d%s", - zlog_default->timestamp_precision, VTY_NEWLINE); + vty_outln (vty, "log timestamp precision %d", + zlog_default->timestamp_precision); if (host.advanced) - vty_out (vty, "service advanced-vty%s", VTY_NEWLINE); + vty_outln (vty, "service advanced-vty"); if (host.encrypt) - vty_out (vty, "service password-encryption%s", VTY_NEWLINE); + vty_outln (vty, "service password-encryption"); if (host.lines >= 0) - vty_out (vty, "service terminal-length %d%s", host.lines, - VTY_NEWLINE); + vty_outln (vty, "service terminal-length %d",host.lines); if (host.motdfile) - vty_out (vty, "banner motd file %s%s", host.motdfile, VTY_NEWLINE); + vty_outln (vty, "banner motd file %s", host.motdfile); else if (! host.motd) - vty_out (vty, "no banner motd%s", VTY_NEWLINE); + vty_outln (vty, "no banner motd"); return 1; } @@ -1151,7 +1149,7 @@ DEFUN (config_terminal, vty->node = CONFIG_NODE; else { - vty_out (vty, "VTY configuration is locked by other VTY%s", VTY_NEWLINE); + vty_outln (vty, "VTY configuration is locked by other VTY"); return CMD_WARNING; } return CMD_SUCCESS; @@ -1348,12 +1346,11 @@ DEFUN (show_version, SHOW_STR "Displays zebra version\n") { - vty_out (vty, "%s %s (%s).%s", FRR_FULL_NAME, FRR_VERSION, - host.name ? host.name : "", - VTY_NEWLINE); - vty_out (vty, "%s%s%s", FRR_COPYRIGHT, GIT_INFO, VTY_NEWLINE); - vty_out (vty, "configured with:%s %s%s", VTY_NEWLINE, - FRR_CONFIG_ARGS, VTY_NEWLINE); + vty_outln (vty, "%s %s (%s).", FRR_FULL_NAME, FRR_VERSION, + host.name ? host.name : ""); + vty_outln (vty, "%s%s", FRR_COPYRIGHT, GIT_INFO); + vty_outln (vty, "configured with:%s %s", VTY_NEWLINE, + FRR_CONFIG_ARGS); return CMD_SUCCESS; } @@ -1376,7 +1373,7 @@ DEFUN (config_help, "help", "Description of the interactive help system\n") { - vty_out (vty, + vty_outln (vty, "Quagga VTY provides advanced help feature. When you need help,%s\ anytime at the command line please press '?'.%s\ %s\ @@ -1388,9 +1385,9 @@ command argument (e.g. 'show ?') and describes each possible%s\ argument.%s\ 2. Partial help is provided when an abbreviated argument is entered%s\ and you want to know what arguments match the input%s\ - (e.g. 'show me?'.)%s%s", VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, + (e.g. 'show me?'.)%s", VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, - VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); + VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); return CMD_SUCCESS; } @@ -1424,7 +1421,7 @@ permute (struct graph_node *start, struct vty *vty) } if (gn == start) vty_out (vty, "..."); - vty_out (vty, VTY_NEWLINE); + vty_outln (vty, ""); } else { @@ -1458,7 +1455,7 @@ cmd_list_cmds (struct vty *vty, int do_permute) if ((element = vector_slot (node->cmd_vector, i)) && element->attr != CMD_ATTR_DEPRECATED && element->attr != CMD_ATTR_HIDDEN) - vty_out (vty, " %s%s", element->string, VTY_NEWLINE); + vty_outln (vty, " %s", element->string); } return CMD_SUCCESS; } @@ -1491,26 +1488,25 @@ vty_write_config (struct vty *vty) if (vty->type == VTY_TERM) { - vty_out (vty, "%sCurrent configuration:%s", VTY_NEWLINE, - VTY_NEWLINE); - vty_out (vty, "!%s", VTY_NEWLINE); + vty_outln (vty, "%sCurrent configuration:",VTY_NEWLINE); + vty_outln (vty, "!"); } - vty_out (vty, "frr version %s%s", FRR_VER_SHORT, VTY_NEWLINE); - vty_out (vty, "frr defaults %s%s", DFLT_NAME, VTY_NEWLINE); - vty_out (vty, "!%s", VTY_NEWLINE); + vty_outln (vty, "frr version %s", FRR_VER_SHORT); + vty_outln (vty, "frr defaults %s", DFLT_NAME); + vty_outln (vty, "!"); for (i = 0; i < vector_active (cmdvec); i++) if ((node = vector_slot (cmdvec, i)) && node->func && (node->vtysh || vty->type != VTY_SHELL)) { if ((*node->func) (vty)) - vty_out (vty, "!%s", VTY_NEWLINE); + vty_outln (vty, "!"); } if (vty->type == VTY_TERM) { - vty_out (vty, "end%s",VTY_NEWLINE); + vty_outln (vty, "end"); } } @@ -1547,8 +1543,7 @@ DEFUN (config_write, /* Check and see if we are operating under vtysh configuration */ if (host.config == NULL) { - vty_out (vty, "Can't save to configuration file, using vtysh.%s", - VTY_NEWLINE); + vty_outln (vty,"Can't save to configuration file, using vtysh."); return CMD_WARNING; } @@ -1583,14 +1578,13 @@ DEFUN (config_write, fd = mkstemp (config_file_tmp); if (fd < 0) { - vty_out (vty, "Can't open configuration file %s.%s", config_file_tmp, - VTY_NEWLINE); + vty_outln (vty, "Can't open configuration file %s.",config_file_tmp); goto finished; } if (fchmod (fd, CONFIGFILE_MASK) != 0) { - vty_out (vty, "Can't chmod configuration file %s: %s (%d).%s", - config_file_tmp, safe_strerror(errno), errno, VTY_NEWLINE); + vty_outln (vty, "Can't chmod configuration file %s: %s (%d).", + config_file_tmp, safe_strerror(errno), errno); goto finished; } @@ -1611,14 +1605,14 @@ DEFUN (config_write, if (unlink (config_file_sav) != 0) if (errno != ENOENT) { - vty_out (vty, "Can't unlink backup configuration file %s.%s", config_file_sav, - VTY_NEWLINE); + vty_outln (vty, "Can't unlink backup configuration file %s.", + config_file_sav); goto finished; } if (link (config_file, config_file_sav) != 0) { - vty_out (vty, "Can't backup old configuration file %s.%s", config_file_sav, - VTY_NEWLINE); + vty_outln (vty, "Can't backup old configuration file %s.", + config_file_sav); goto finished; } if (dirfd >= 0) @@ -1626,15 +1620,13 @@ DEFUN (config_write, } if (rename (config_file_tmp, config_file) != 0) { - vty_out (vty, "Can't save configuration file %s.%s", config_file, - VTY_NEWLINE); + vty_outln (vty, "Can't save configuration file %s.",config_file); goto finished; } if (dirfd >= 0) fsync (dirfd); - vty_out (vty, "Configuration saved to %s%s", config_file, - VTY_NEWLINE); + vty_outln (vty, "Configuration saved to %s",config_file); ret = CMD_SUCCESS; finished: @@ -1689,8 +1681,8 @@ DEFUN (show_startup_config, confp = fopen (host.config, "r"); if (confp == NULL) { - vty_out (vty, "Can't open configuration file [%s] due to '%s'%s", - host.config, safe_strerror(errno), VTY_NEWLINE); + vty_outln (vty, "Can't open configuration file [%s] due to '%s'", + host.config, safe_strerror(errno)); return CMD_WARNING; } @@ -1702,7 +1694,7 @@ DEFUN (show_startup_config, cp++; *cp = '\0'; - vty_out (vty, "%s%s", buf, VTY_NEWLINE); + vty_outln (vty, "%s", buf); } fclose (confp); @@ -1729,7 +1721,7 @@ DEFUN (config_hostname, if (!isalpha((int) word->arg[0])) { - vty_out (vty, "Please specify string starting with alphabet%s", VTY_NEWLINE); + vty_outln (vty, "Please specify string starting with alphabet"); return CMD_WARNING; } @@ -1769,8 +1761,8 @@ DEFUN (config_password, if (!isalnum (argv[idx_8]->arg[0])) { - vty_out (vty, - "Please specify string starting with alphanumeric%s", VTY_NEWLINE); + vty_outln (vty, + "Please specify string starting with alphanumeric"); return CMD_WARNING; } @@ -1819,15 +1811,15 @@ DEFUN (config_enable_password, } else { - vty_out (vty, "Unknown encryption type.%s", VTY_NEWLINE); + vty_outln (vty, "Unknown encryption type."); return CMD_WARNING; } } if (!isalnum (argv[idx_8]->arg[0])) { - vty_out (vty, - "Please specify string starting with alphanumeric%s", VTY_NEWLINE); + vty_outln (vty, + "Please specify string starting with alphanumeric"); return CMD_WARNING; } @@ -1976,8 +1968,8 @@ DEFUN_HIDDEN (do_echo, { char *message; - vty_out (vty, "%s%s", ((message = argv_concat (argv, argc, 1)) ? message : ""), - VTY_NEWLINE); + vty_outln (vty, "%s", + ((message = argv_concat(argv, argc, 1)) ? message : "")); if (message) XFREE(MTYPE_TMP, message); return CMD_SUCCESS; @@ -2020,7 +2012,7 @@ DEFUN (show_logging, vty_out (vty, "level %s, facility %s, ident %s", zlog_priority[zl->maxlvl[ZLOG_DEST_SYSLOG]], facility_name(zl->facility), zl->ident); - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); vty_out (vty, "Stdout logging: "); if (zl->maxlvl[ZLOG_DEST_STDOUT] == ZLOG_DISABLED) @@ -2028,7 +2020,7 @@ DEFUN (show_logging, else vty_out (vty, "level %s", zlog_priority[zl->maxlvl[ZLOG_DEST_STDOUT]]); - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); vty_out (vty, "Monitor logging: "); if (zl->maxlvl[ZLOG_DEST_MONITOR] == ZLOG_DISABLED) @@ -2036,7 +2028,7 @@ DEFUN (show_logging, else vty_out (vty, "level %s", zlog_priority[zl->maxlvl[ZLOG_DEST_MONITOR]]); - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); vty_out (vty, "File logging: "); if ((zl->maxlvl[ZLOG_DEST_FILE] == ZLOG_DISABLED) || @@ -2046,14 +2038,14 @@ DEFUN (show_logging, vty_out (vty, "level %s, filename %s", zlog_priority[zl->maxlvl[ZLOG_DEST_FILE]], zl->filename); - vty_out (vty, "%s", VTY_NEWLINE); - - vty_out (vty, "Protocol name: %s%s", - zl->protoname, VTY_NEWLINE); - vty_out (vty, "Record priority: %s%s", - (zl->record_priority ? "enabled" : "disabled"), VTY_NEWLINE); - vty_out (vty, "Timestamp precision: %d%s", - zl->timestamp_precision, VTY_NEWLINE); + vty_outln (vty, ""); + + vty_outln (vty, "Protocol name: %s", + zl->protoname); + vty_outln (vty, "Record priority: %s", + (zl->record_priority ? "enabled" : "disabled")); + vty_outln (vty, "Timestamp precision: %d", + zl->timestamp_precision); return CMD_SUCCESS; } diff --git a/lib/distribute.c b/lib/distribute.c index 7b7d49d1d6..a935e84ad6 100644 --- a/lib/distribute.c +++ b/lib/distribute.c @@ -349,7 +349,7 @@ DEFUN (no_distribute_list, if (! ret) { - vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE); + vty_outln (vty, "distribute list doesn't exist"); return CMD_WARNING; } return CMD_SUCCESS; @@ -393,9 +393,9 @@ config_show_distribute (struct vty *vty) DISTRIBUTE_V6_OUT, has_print); } if (has_print) - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); else - vty_out (vty, " not set%s", VTY_NEWLINE); + vty_outln (vty, " not set"); for (i = 0; i < disthash->size; i++) for (mp = disthash->index[i]; mp; mp = mp->next) @@ -414,9 +414,9 @@ config_show_distribute (struct vty *vty) has_print = distribute_print(vty, dist->prefix, 1, DISTRIBUTE_V6_OUT, has_print); if (has_print) - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); else - vty_out(vty, " nothing%s", VTY_NEWLINE); + vty_outln (vty, " nothing"); } } @@ -437,9 +437,9 @@ config_show_distribute (struct vty *vty) DISTRIBUTE_V6_IN, has_print); } if (has_print) - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); else - vty_out (vty, " not set%s", VTY_NEWLINE); + vty_outln (vty, " not set"); for (i = 0; i < disthash->size; i++) for (mp = disthash->index[i]; mp; mp = mp->next) @@ -458,9 +458,9 @@ config_show_distribute (struct vty *vty) has_print = distribute_print(vty, dist->prefix, 1, DISTRIBUTE_V6_IN, has_print); if (has_print) - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); else - vty_out(vty, " nothing%s", VTY_NEWLINE); + vty_outln (vty, " nothing"); } } return 0; @@ -487,12 +487,11 @@ config_write_distribute (struct vty *vty) if (dist->list[j]) { output = j == DISTRIBUTE_V4_OUT || j == DISTRIBUTE_V6_OUT; v6 = j == DISTRIBUTE_V6_IN || j == DISTRIBUTE_V6_OUT; - vty_out (vty, " %sdistribute-list %s %s %s%s", + vty_outln (vty, " %sdistribute-list %s %s %s", v6 ? "ipv6 " : "", dist->list[j], output ? "out" : "in", - dist->ifname ? dist->ifname : "", - VTY_NEWLINE); + dist->ifname ? dist->ifname : ""); write++; } @@ -500,12 +499,11 @@ config_write_distribute (struct vty *vty) if (dist->prefix[j]) { output = j == DISTRIBUTE_V4_OUT || j == DISTRIBUTE_V6_OUT; v6 = j == DISTRIBUTE_V6_IN || j == DISTRIBUTE_V6_OUT; - vty_out (vty, " %sdistribute-list prefix %s %s %s%s", + vty_outln (vty, " %sdistribute-list prefix %s %s %s", v6 ? "ipv6 " : "", dist->prefix[j], output ? "out" : "in", - dist->ifname ? dist->ifname : "", - VTY_NEWLINE); + dist->ifname ? dist->ifname : ""); write++; } } diff --git a/lib/filter.c b/lib/filter.c index 01301de4b9..06f661c191 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -576,8 +576,7 @@ vty_access_list_remark_unset (struct vty *vty, afi_t afi, const char *name) access = access_list_lookup (afi, name); if (! access) { - vty_out (vty, "%% access-list %s doesn't exist%s", name, - VTY_NEWLINE); + vty_outln (vty, "%% access-list %s doesn't exist",name); return CMD_WARNING; } @@ -616,23 +615,21 @@ filter_set_cisco (struct vty *vty, const char *name_str, const char *type_str, type = FILTER_DENY; else { - vty_out (vty, "%% filter type must be permit or deny%s", VTY_NEWLINE); + vty_outln (vty, "%% filter type must be permit or deny"); return CMD_WARNING; } ret = inet_aton (addr_str, &addr); if (ret <= 0) { - vty_out (vty, "%%Inconsistent address and mask%s", - VTY_NEWLINE); + vty_outln (vty,"%%Inconsistent address and mask"); return CMD_WARNING; } ret = inet_aton (addr_mask_str, &addr_mask); if (ret <= 0) { - vty_out (vty, "%%Inconsistent address and mask%s", - VTY_NEWLINE); + vty_outln (vty,"%%Inconsistent address and mask"); return CMD_WARNING; } @@ -641,16 +638,14 @@ filter_set_cisco (struct vty *vty, const char *name_str, const char *type_str, ret = inet_aton (mask_str, &mask); if (ret <= 0) { - vty_out (vty, "%%Inconsistent address and mask%s", - VTY_NEWLINE); + vty_outln (vty,"%%Inconsistent address and mask"); return CMD_WARNING; } ret = inet_aton (mask_mask_str, &mask_mask); if (ret <= 0) { - vty_out (vty, "%%Inconsistent address and mask%s", - VTY_NEWLINE); + vty_outln (vty,"%%Inconsistent address and mask"); return CMD_WARNING; } } @@ -1261,9 +1256,9 @@ filter_set_zebra (struct vty *vty, const char *name_str, const char *type_str, if (strlen(name_str) > ACL_NAMSIZ) { - vty_out (vty, "%% ACL name %s is invalid: length exceeds " - "%d characters%s", - name_str, ACL_NAMSIZ, VTY_NEWLINE); + vty_outln (vty, "%% ACL name %s is invalid: length exceeds " + "%d characters", + name_str, ACL_NAMSIZ); return CMD_WARNING; } @@ -1274,7 +1269,7 @@ filter_set_zebra (struct vty *vty, const char *name_str, const char *type_str, type = FILTER_DENY; else { - vty_out (vty, "filter type must be [permit|deny]%s", VTY_NEWLINE); + vty_outln (vty, "filter type must be [permit|deny]"); return CMD_WARNING; } @@ -1284,8 +1279,7 @@ filter_set_zebra (struct vty *vty, const char *name_str, const char *type_str, ret = str2prefix_ipv4 (prefix_str, (struct prefix_ipv4 *)&p); if (ret <= 0) { - vty_out (vty, "IP address prefix/prefixlen is malformed%s", - VTY_NEWLINE); + vty_outln (vty,"IP address prefix/prefixlen is malformed"); return CMD_WARNING; } } @@ -1294,8 +1288,7 @@ filter_set_zebra (struct vty *vty, const char *name_str, const char *type_str, ret = str2prefix_ipv6 (prefix_str, (struct prefix_ipv6 *) &p); if (ret <= 0) { - vty_out (vty, "IPv6 address prefix/prefixlen is malformed%s", - VTY_NEWLINE); + vty_outln (vty,"IPv6 address prefix/prefixlen is malformed"); return CMD_WARNING; } } @@ -1431,8 +1424,7 @@ DEFUN (no_access_list_all, access = access_list_lookup (AFI_IP, argv[idx_acl]->arg); if (access == NULL) { - vty_out (vty, "%% access-list %s doesn't exist%s", argv[idx_acl]->arg, - VTY_NEWLINE); + vty_outln (vty, "%% access-list %s doesn't exist",argv[idx_acl]->arg); return CMD_WARNING; } @@ -1609,8 +1601,7 @@ DEFUN (no_ipv6_access_list_all, access = access_list_lookup (AFI_IP6, argv[idx_word]->arg); if (access == NULL) { - vty_out (vty, "%% access-list %s doesn't exist%s", argv[idx_word]->arg, - VTY_NEWLINE); + vty_outln (vty, "%% access-list %s doesn't exist",argv[idx_word]->arg); return CMD_WARNING; } @@ -1697,7 +1688,7 @@ filter_show (struct vty *vty, const char *name, afi_t afi) return 0; /* Print the name of the protocol */ - vty_out(vty, "%s:%s", frr_protoname, VTY_NEWLINE); + vty_outln (vty, "%s:", frr_protoname); for (access = master->num.head; access; access = access->next) { @@ -1712,11 +1703,11 @@ filter_show (struct vty *vty, const char *name, afi_t afi) if (write) { - vty_out (vty, "%s IP%s access list %s%s", + vty_outln (vty, "%s IP%s access list %s", mfilter->cisco ? (filter->extended ? "Extended" : "Standard") : "Zebra", afi == AFI_IP6 ? "v6" : "", - access->name, VTY_NEWLINE); + access->name); write = 0; } @@ -1730,13 +1721,13 @@ filter_show (struct vty *vty, const char *name, afi_t afi) else { if (filter->addr_mask.s_addr == 0xffffffff) - vty_out (vty, " any%s", VTY_NEWLINE); + vty_outln (vty, " any"); else { vty_out (vty, " %s", inet_ntoa (filter->addr)); if (filter->addr_mask.s_addr != 0) vty_out (vty, ", wildcard bits %s", inet_ntoa (filter->addr_mask)); - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); } } } @@ -1755,11 +1746,11 @@ filter_show (struct vty *vty, const char *name, afi_t afi) if (write) { - vty_out (vty, "%s IP%s access list %s%s", + vty_outln (vty, "%s IP%s access list %s", mfilter->cisco ? (filter->extended ? "Extended" : "Standard") : "Zebra", afi == AFI_IP6 ? "v6" : "", - access->name, VTY_NEWLINE); + access->name); write = 0; } @@ -1773,13 +1764,13 @@ filter_show (struct vty *vty, const char *name, afi_t afi) else { if (filter->addr_mask.s_addr == 0xffffffff) - vty_out (vty, " any%s", VTY_NEWLINE); + vty_outln (vty, " any"); else { vty_out (vty, " %s", inet_ntoa (filter->addr)); if (filter->addr_mask.s_addr != 0) vty_out (vty, ", wildcard bits %s", inet_ntoa (filter->addr_mask)); - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); } } } @@ -1864,18 +1855,18 @@ config_write_access_cisco (struct vty *vty, struct filter *mfilter) vty_out (vty, " %s", inet_ntoa (filter->mask)); vty_out (vty, " %s", inet_ntoa (filter->mask_mask)); } - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); } else { if (filter->addr_mask.s_addr == 0xffffffff) - vty_out (vty, " any%s", VTY_NEWLINE); + vty_outln (vty, " any"); else { vty_out (vty, " %s", inet_ntoa (filter->addr)); if (filter->addr_mask.s_addr != 0) vty_out (vty, " %s", inet_ntoa (filter->addr_mask)); - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); } } } @@ -1898,7 +1889,7 @@ config_write_access_zebra (struct vty *vty, struct filter *mfilter) p->prefixlen, filter->exact ? " exact-match" : ""); - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); } static int @@ -1917,10 +1908,9 @@ config_write_access (struct vty *vty, afi_t afi) { if (access->remark) { - vty_out (vty, "%saccess-list %s remark %s%s", + vty_outln (vty, "%saccess-list %s remark %s", afi == AFI_IP ? "" : "ipv6 ", - access->name, access->remark, - VTY_NEWLINE); + access->name,access->remark); write++; } @@ -1944,10 +1934,9 @@ config_write_access (struct vty *vty, afi_t afi) { if (access->remark) { - vty_out (vty, "%saccess-list %s remark %s%s", + vty_outln (vty, "%saccess-list %s remark %s", afi == AFI_IP ? "" : "ipv6 ", - access->name, access->remark, - VTY_NEWLINE); + access->name,access->remark); write++; } diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index f4a8df26c0..1eb01c4efa 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -118,7 +118,7 @@ DEFUN (grammar_test_complete, // print completions for (i = 0; i < vector_active (comps); i++) { tkn = vector_slot (comps, i); - vty_out (vty, " %-*s %s%s", width, tkn->text, tkn->desc, VTY_NEWLINE); + vty_outln (vty, " %-*s %s", width, tkn->text, tkn->desc); } for (i = 0; i < vector_active (comps); i++) @@ -126,7 +126,7 @@ DEFUN (grammar_test_complete, vector_free (comps); } else - vty_out (vty, "%% No match%s", VTY_NEWLINE); + vty_outln (vty, "%% No match"); // free resources list_delete (completions); @@ -164,13 +164,13 @@ DEFUN (grammar_test_match, // print completions or relevant error message if (element) { - vty_out (vty, "Matched: %s%s", element->string, VTY_NEWLINE); + vty_outln (vty, "Matched: %s", element->string); struct listnode *ln; struct cmd_token *token; for (ALL_LIST_ELEMENTS_RO(argvv,ln,token)) - vty_out (vty, "%s -- %s%s", token->text, token->arg, VTY_NEWLINE); + vty_outln (vty, "%s -- %s", token->text, token->arg); - vty_out (vty, "func: %p%s", element->func, VTY_NEWLINE); + vty_outln (vty, "func: %p", element->func); list_delete (argvv); } @@ -178,16 +178,16 @@ DEFUN (grammar_test_match, assert(MATCHER_ERROR(result)); switch (result) { case MATCHER_NO_MATCH: - vty_out (vty, "%% Unknown command%s", VTY_NEWLINE); + vty_outln (vty, "%% Unknown command"); break; case MATCHER_INCOMPLETE: - vty_out (vty, "%% Incomplete command%s", VTY_NEWLINE); + vty_outln (vty, "%% Incomplete command"); break; case MATCHER_AMBIGUOUS: - vty_out (vty, "%% Ambiguous command%s", VTY_NEWLINE); + vty_outln (vty, "%% Ambiguous command"); break; default: - vty_out (vty, "%% Unknown error%s", VTY_NEWLINE); + vty_outln (vty, "%% Unknown error"); break; } } @@ -401,7 +401,7 @@ DEFUN (grammar_findambig, nodegraph = cnode->cmdgraph; if (!nodegraph) continue; - vty_out (vty, "scanning node %d%s", scannode - 1, VTY_NEWLINE); + vty_outln (vty, "scanning node %d", scannode - 1); } commands = cmd_graph_permutations (nodegraph); @@ -410,23 +410,25 @@ DEFUN (grammar_findambig, { int same = prev && !strcmp (prev->cmd, cur->cmd); if (printall && !same) - vty_out (vty, "'%s' [%x]%s", cur->cmd, cur->el->daemon, VTY_NEWLINE); + vty_outln (vty, "'%s' [%x]", cur->cmd, cur->el->daemon); if (same) { - vty_out (vty, "'%s' AMBIGUOUS:%s", cur->cmd, VTY_NEWLINE); - vty_out (vty, " %s%s '%s'%s", prev->el->name, VTY_NEWLINE, prev->el->string, VTY_NEWLINE); - vty_out (vty, " %s%s '%s'%s", cur->el->name, VTY_NEWLINE, cur->el->string, VTY_NEWLINE); - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, "'%s' AMBIGUOUS:", cur->cmd); + vty_outln (vty, " %s%s '%s'", prev->el->name, VTY_NEWLINE, + prev->el->string); + vty_outln (vty, " %s%s '%s'", cur->el->name, VTY_NEWLINE, + cur->el->string); + vty_outln (vty, ""); ambig++; } prev = cur; } list_delete (commands); - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); } while (scan && scannode < LINK_PARAMS_NODE); - vty_out (vty, "%d ambiguous commands found.%s", ambig, VTY_NEWLINE); + vty_outln (vty, "%d ambiguous commands found.", ambig); if (scan) nodegraph = NULL; @@ -463,11 +465,11 @@ DEFUN (grammar_access, cnode = vector_slot (cmdvec, atoi (argv[2]->arg)); if (!cnode) { - vty_out (vty, "%% no such node%s", VTY_NEWLINE); + vty_outln (vty, "%% no such node"); return CMD_WARNING; } - vty_out (vty, "node %d%s", (int)cnode->node, VTY_NEWLINE); + vty_outln (vty, "node %d", (int)cnode->node); nodegraph = cnode->cmdgraph; return CMD_SUCCESS; } @@ -532,7 +534,7 @@ pretty_print_graph (struct vty *vty, struct graph_node *start, int level, if (stackpos == MAXDEPTH) { - vty_out(vty, " -aborting! (depth limit)%s", VTY_NEWLINE); + vty_outln (vty, " -aborting! (depth limit)"); return; } stack[stackpos++] = start; @@ -541,7 +543,7 @@ pretty_print_graph (struct vty *vty, struct graph_node *start, int level, if (numto) { if (numto > 1) - vty_out(vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); for (unsigned int i = 0; i < vector_active (start->to); i++) { struct graph_node *adj = vector_slot (start->to, i); @@ -553,12 +555,12 @@ pretty_print_graph (struct vty *vty, struct graph_node *start, int level, if (adj == start) vty_out(vty, "*"); else if (((struct cmd_token *)adj->data)->type == END_TKN) - vty_out(vty, "--END%s", VTY_NEWLINE); + vty_outln (vty, "--END"); else { size_t k; for (k = 0; k < stackpos; k++) if (stack[k] == adj) { - vty_out(vty, "<<loop@%zu %s", k, VTY_NEWLINE); + vty_outln (vty, "<<loop@%zu ", k); break; } if (k == stackpos) @@ -567,7 +569,7 @@ pretty_print_graph (struct vty *vty, struct graph_node *start, int level, } } else - vty_out(vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); } static void @@ -650,5 +652,5 @@ init_cmdgraph (struct vty *vty, struct graph **graph) struct cmd_token *token = cmd_token_new (START_TKN, 0, NULL, NULL); graph_new_node (*graph, token, (void (*)(void *)) &cmd_token_del); if (vty) - vty_out (vty, "initialized graph%s", VTY_NEWLINE); + vty_outln (vty, "initialized graph"); } @@ -694,9 +694,9 @@ DEFUN (interface, if ((sl = strlen(ifname)) > INTERFACE_NAMSIZ) { - vty_out (vty, "%% Interface name %s is invalid: length exceeds " - "%d characters%s", - ifname, INTERFACE_NAMSIZ, VTY_NEWLINE); + vty_outln (vty, "%% Interface name %s is invalid: length exceeds " + "%d characters", + ifname, INTERFACE_NAMSIZ); return CMD_WARNING; } @@ -713,7 +713,7 @@ DEFUN (interface, if (!ifp) { - vty_out (vty, "%% interface %s not in %s%s", ifname, vrfname, VTY_NEWLINE); + vty_outln (vty, "%% interface %s not in %s", ifname, vrfname); return CMD_WARNING; } VTY_PUSH_CONTEXT (INTERFACE_NODE, ifp); diff --git a/lib/if_rmap.c b/lib/if_rmap.c index fa9b17f2ae..f9c6a55d7b 100644 --- a/lib/if_rmap.c +++ b/lib/if_rmap.c @@ -228,7 +228,7 @@ DEFUN (if_rmap, type = IF_RMAP_OUT; else { - vty_out (vty, "route-map direction must be [in|out]%s", VTY_NEWLINE); + vty_outln (vty, "route-map direction must be [in|out]"); return CMD_WARNING; } @@ -259,14 +259,14 @@ DEFUN (no_if_rmap, type = IF_RMAP_OUT; else { - vty_out (vty, "route-map direction must be [in|out]%s", VTY_NEWLINE); + vty_outln (vty, "route-map direction must be [in|out]"); return CMD_WARNING; } ret = if_rmap_unset (argv[idx_ifname]->arg, type, argv[idx_routemap_name]->arg); if (! ret) { - vty_out (vty, "route-map doesn't exist%s", VTY_NEWLINE); + vty_outln (vty, "route-map doesn't exist"); return CMD_WARNING; } return CMD_SUCCESS; @@ -290,19 +290,17 @@ config_write_if_rmap (struct vty *vty) if (if_rmap->routemap[IF_RMAP_IN]) { - vty_out (vty, " route-map %s in %s%s", + vty_outln (vty, " route-map %s in %s", if_rmap->routemap[IF_RMAP_IN], - if_rmap->ifname, - VTY_NEWLINE); + if_rmap->ifname); write++; } if (if_rmap->routemap[IF_RMAP_OUT]) { - vty_out (vty, " route-map %s out %s%s", + vty_outln (vty, " route-map %s out %s", if_rmap->routemap[IF_RMAP_OUT], - if_rmap->ifname, - VTY_NEWLINE); + if_rmap->ifname); write++; } } diff --git a/lib/keychain.c b/lib/keychain.c index 0624ef69e3..708b22252d 100644 --- a/lib/keychain.c +++ b/lib/keychain.c @@ -271,7 +271,7 @@ DEFUN (no_key_chain, if (! keychain) { - vty_out (vty, "Can't find keychain %s%s", argv[idx_word]->arg, VTY_NEWLINE); + vty_outln (vty, "Can't find keychain %s", argv[idx_word]->arg); return CMD_WARNING; } @@ -314,7 +314,7 @@ DEFUN (no_key, key = key_lookup (keychain, index); if (! key) { - vty_out (vty, "Can't find key %d%s", index, VTY_NEWLINE); + vty_outln (vty, "Can't find key %d", index); return CMD_WARNING; } @@ -477,20 +477,20 @@ key_lifetime_set (struct vty *vty, struct key_range *krange, time_start = key_str2time (stime_str, sday_str, smonth_str, syear_str); if (time_start < 0) { - vty_out (vty, "Malformed time value%s", VTY_NEWLINE); + vty_outln (vty, "Malformed time value"); return CMD_WARNING; } time_end = key_str2time (etime_str, eday_str, emonth_str, eyear_str); if (time_end < 0) { - vty_out (vty, "Malformed time value%s", VTY_NEWLINE); + vty_outln (vty, "Malformed time value"); return CMD_WARNING; } if (time_end <= time_start) { - vty_out (vty, "Expire time is not later than start time%s", VTY_NEWLINE); + vty_outln (vty, "Expire time is not later than start time"); return CMD_WARNING; } @@ -512,7 +512,7 @@ key_lifetime_duration_set (struct vty *vty, struct key_range *krange, time_start = key_str2time (stime_str, sday_str, smonth_str, syear_str); if (time_start < 0) { - vty_out (vty, "Malformed time value%s", VTY_NEWLINE); + vty_outln (vty, "Malformed time value"); return CMD_WARNING; } krange->start = time_start; @@ -534,7 +534,7 @@ key_lifetime_infinite_set (struct vty *vty, struct key_range *krange, time_start = key_str2time (stime_str, sday_str, smonth_str, syear_str); if (time_start < 0) { - vty_out (vty, "Malformed time value%s", VTY_NEWLINE); + vty_outln (vty, "Malformed time value"); return CMD_WARNING; } krange->start = time_start; @@ -966,14 +966,14 @@ keychain_config_write (struct vty *vty) for (ALL_LIST_ELEMENTS_RO (keychain_list, node, keychain)) { - vty_out (vty, "key chain %s%s", keychain->name, VTY_NEWLINE); + vty_outln (vty, "key chain %s", keychain->name); for (ALL_LIST_ELEMENTS_RO (keychain->key, knode, key)) { - vty_out (vty, " key %d%s", key->index, VTY_NEWLINE); + vty_outln (vty, " key %d", key->index); if (key->string) - vty_out (vty, " key-string %s%s", key->string, VTY_NEWLINE); + vty_outln (vty, " key-string %s", key->string); if (key->accept.start) { @@ -990,7 +990,7 @@ keychain_config_write (struct vty *vty) keychain_strftime (buf, BUFSIZ, &key->accept.end); vty_out (vty, " %s", buf); } - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); } if (key->send.start) @@ -1007,10 +1007,10 @@ keychain_config_write (struct vty *vty) keychain_strftime (buf, BUFSIZ, &key->send.end); vty_out (vty, " %s", buf); } - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); } } - vty_out (vty, "!%s", VTY_NEWLINE); + vty_outln (vty, "!"); } return 0; diff --git a/lib/memory_vty.c b/lib/memory_vty.c index 27254cfa5b..56621869f9 100644 --- a/lib/memory_vty.c +++ b/lib/memory_vty.c @@ -44,36 +44,26 @@ show_memory_mallinfo (struct vty *vty) struct mallinfo minfo = mallinfo(); char buf[MTYPE_MEMSTR_LEN]; - vty_out (vty, "System allocator statistics:%s", VTY_NEWLINE); - vty_out (vty, " Total heap allocated: %s%s", - mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.arena), - VTY_NEWLINE); - vty_out (vty, " Holding block headers: %s%s", - mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.hblkhd), - VTY_NEWLINE); - vty_out (vty, " Used small blocks: %s%s", - mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.usmblks), - VTY_NEWLINE); - vty_out (vty, " Used ordinary blocks: %s%s", - mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.uordblks), - VTY_NEWLINE); - vty_out (vty, " Free small blocks: %s%s", - mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.fsmblks), - VTY_NEWLINE); - vty_out (vty, " Free ordinary blocks: %s%s", - mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.fordblks), - VTY_NEWLINE); - vty_out (vty, " Ordinary blocks: %ld%s", - (unsigned long)minfo.ordblks, - VTY_NEWLINE); - vty_out (vty, " Small blocks: %ld%s", - (unsigned long)minfo.smblks, - VTY_NEWLINE); - vty_out (vty, " Holding blocks: %ld%s", - (unsigned long)minfo.hblks, - VTY_NEWLINE); - vty_out (vty, "(see system documentation for 'mallinfo' for meaning)%s", - VTY_NEWLINE); + vty_outln (vty, "System allocator statistics:"); + vty_outln (vty, " Total heap allocated: %s", + mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.arena)); + vty_outln (vty, " Holding block headers: %s", + mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.hblkhd)); + vty_outln (vty, " Used small blocks: %s", + mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.usmblks)); + vty_outln (vty, " Used ordinary blocks: %s", + mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.uordblks)); + vty_outln (vty, " Free small blocks: %s", + mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.fsmblks)); + vty_outln (vty, " Free ordinary blocks: %s", + mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.fordblks)); + vty_outln (vty, " Ordinary blocks: %ld", + (unsigned long)minfo.ordblks); + vty_outln (vty, " Small blocks: %ld", + (unsigned long)minfo.smblks); + vty_outln (vty, " Holding blocks: %ld", + (unsigned long)minfo.hblks); + vty_outln (vty,"(see system documentation for 'mallinfo' for meaning)"); return 1; } #endif /* HAVE_MALLINFO */ @@ -82,16 +72,14 @@ static int qmem_walker(void *arg, struct memgroup *mg, struct memtype *mt) { struct vty *vty = arg; if (!mt) - vty_out (vty, "--- qmem %s ---%s", mg->name, VTY_NEWLINE); + vty_outln (vty, "--- qmem %s ---", mg->name); else { if (mt->n_alloc != 0) { char size[32]; snprintf(size, sizeof(size), "%6zu", mt->size); - vty_out (vty, "%-30s: %10zu %s%s", + vty_outln (vty, "%-30s: %10zu %s", mt->name, mt->n_alloc, - mt->size == 0 ? "" : - mt->size == SIZE_VAR ? "(variably sized)" : - size, VTY_NEWLINE); + mt->size == 0 ? "" : mt->size == SIZE_VAR ? "(variably sized)" : size); } } return 0; @@ -120,15 +108,14 @@ DEFUN (show_modules, { struct frrmod_runtime *plug = frrmod_list; - vty_out (vty, "%-12s %-25s %s%s%s", + vty_outln (vty, "%-12s %-25s %s%s", "Module Name", "Version", "Description", - VTY_NEWLINE, VTY_NEWLINE); + VTY_NEWLINE); while (plug) { const struct frrmod_info *i = plug->info; - vty_out (vty, "%-12s %-25s %s%s", i->name, i->version, i->description, - VTY_NEWLINE); + vty_outln (vty, "%-12s %-25s %s", i->name, i->version,i->description); if (plug->dl_handle) { #ifdef HAVE_DLINFO_ORIGIN @@ -142,13 +129,13 @@ DEFUN (show_modules, { name = strrchr(lm->l_name, '/'); name = name ? name + 1 : lm->l_name; - vty_out (vty, "\tfrom: %s/%s%s", origin, name, VTY_NEWLINE); + vty_outln (vty, "\tfrom: %s/%s", origin, name); } # else - vty_out (vty, "\tfrom: %s %s", origin, plug->load_name, VTY_NEWLINE); + vty_outln (vty, "\tfrom: %s ", origin, plug->load_name); # endif #else - vty_out (vty, "\tfrom: %s%s", plug->load_name, VTY_NEWLINE); + vty_outln (vty, "\tfrom: %s", plug->load_name); #endif } plug = plug->next; @@ -296,8 +296,7 @@ ns_netns_pathname (struct vty *vty, const char *name) if (! result) { - vty_out (vty, "Invalid pathname: %s%s", safe_strerror (errno), - VTY_NEWLINE); + vty_outln (vty, "Invalid pathname: %s",safe_strerror(errno)); return NULL; } return pathname; @@ -366,13 +365,13 @@ DEFUN (no_ns_netns, if (!ns) { - vty_out (vty, "NS %u is not found%s", ns_id, VTY_NEWLINE); + vty_outln (vty, "NS %u is not found", ns_id); return CMD_SUCCESS; } if (ns->name && strcmp (ns->name, pathname) != 0) { - vty_out (vty, "Incorrect NETNS file name%s", VTY_NEWLINE); + vty_outln (vty, "Incorrect NETNS file name"); return CMD_WARNING; } @@ -406,8 +405,7 @@ ns_config_write (struct vty *vty) if (ns->ns_id == NS_DEFAULT || ns->name == NULL) continue; - vty_out (vty, "logical-router %u netns %s%s", ns->ns_id, ns->name, - VTY_NEWLINE); + vty_outln (vty, "logical-router %u netns %s", ns->ns_id,ns->name); write = 1; } diff --git a/lib/plist.c b/lib/plist.c index 7be56d4320..9b4bda7edc 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -882,8 +882,8 @@ prefix_entry_dup_check (struct prefix_list *plist, static int vty_invalid_prefix_range (struct vty *vty, const char *prefix) { - vty_out (vty, "%% Invalid prefix range for %s, make sure: len < ge-value <= le-value%s", - prefix, VTY_NEWLINE); + vty_outln (vty, "%% Invalid prefix range for %s, make sure: len < ge-value <= le-value", + prefix); return CMD_WARNING; } @@ -920,7 +920,7 @@ vty_prefix_list_install (struct vty *vty, afi_t afi, const char *name, type = PREFIX_DENY; else { - vty_out (vty, "%% prefix type must be permit or deny%s", VTY_NEWLINE); + vty_outln (vty, "%% prefix type must be permit or deny"); return CMD_WARNING; } @@ -940,7 +940,7 @@ vty_prefix_list_install (struct vty *vty, afi_t afi, const char *name, if (ret <= 0) { - vty_out (vty, "%% Malformed IPv4 prefix%s", VTY_NEWLINE); + vty_outln (vty, "%% Malformed IPv4 prefix"); return CMD_WARNING; } @@ -962,7 +962,7 @@ vty_prefix_list_install (struct vty *vty, afi_t afi, const char *name, if (ret <= 0) { - vty_out (vty, "%% Malformed IPv6 prefix%s", VTY_NEWLINE); + vty_outln (vty, "%% Malformed IPv6 prefix"); return CMD_WARNING; } @@ -973,7 +973,7 @@ vty_prefix_list_install (struct vty *vty, afi_t afi, const char *name, break; case AFI_L2VPN: default: - vty_out (vty, "%% Unrecognized AFI (%d)%s", afi, VTY_NEWLINE); + vty_outln (vty, "%% Unrecognized AFI (%d)", afi); return CMD_WARNING; break; } @@ -1042,7 +1042,7 @@ vty_prefix_list_uninstall (struct vty *vty, afi_t afi, const char *name, plist = prefix_list_lookup (afi, name); if (! plist) { - vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE); + vty_outln (vty, "%% Can't find specified prefix-list"); return CMD_WARNING; } @@ -1057,7 +1057,7 @@ vty_prefix_list_uninstall (struct vty *vty, afi_t afi, const char *name, /* We must have, at a minimum, both the type and prefix here */ if ((typestr == NULL) || (prefix == NULL)) { - vty_out (vty, "%% Both prefix and type required%s", VTY_NEWLINE); + vty_outln (vty, "%% Both prefix and type required"); return CMD_WARNING; } @@ -1078,7 +1078,7 @@ vty_prefix_list_uninstall (struct vty *vty, afi_t afi, const char *name, type = PREFIX_DENY; else { - vty_out (vty, "%% prefix type must be permit or deny%s", VTY_NEWLINE); + vty_outln (vty, "%% prefix type must be permit or deny"); return CMD_WARNING; } @@ -1096,7 +1096,7 @@ vty_prefix_list_uninstall (struct vty *vty, afi_t afi, const char *name, if (ret <= 0) { - vty_out (vty, "%% Malformed IPv4 prefix%s", VTY_NEWLINE); + vty_outln (vty, "%% Malformed IPv4 prefix"); return CMD_WARNING; } } @@ -1113,7 +1113,7 @@ vty_prefix_list_uninstall (struct vty *vty, afi_t afi, const char *name, if (ret <= 0) { - vty_out (vty, "%% Malformed IPv6 prefix%s", VTY_NEWLINE); + vty_outln (vty, "%% Malformed IPv6 prefix"); return CMD_WARNING; } } @@ -1123,7 +1123,7 @@ vty_prefix_list_uninstall (struct vty *vty, afi_t afi, const char *name, if (pentry == NULL) { - vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE); + vty_outln (vty, "%% Can't find specified prefix-list"); return CMD_WARNING; } @@ -1141,7 +1141,7 @@ vty_prefix_list_desc_unset (struct vty *vty, afi_t afi, const char *name) plist = prefix_list_lookup (afi, name); if (! plist) { - vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE); + vty_outln (vty, "%% Can't find specified prefix-list"); return CMD_WARNING; } @@ -1179,25 +1179,24 @@ vty_show_prefix_entry (struct vty *vty, afi_t afi, struct prefix_list *plist, if (dtype == normal_display) { - vty_out (vty, "ip%s prefix-list %s: %d entries%s", + vty_outln (vty, "ip%s prefix-list %s: %d entries", afi == AFI_IP ? "" : "v6", - plist->name, plist->count, VTY_NEWLINE); + plist->name, plist->count); if (plist->desc) - vty_out (vty, " Description: %s%s", plist->desc, VTY_NEWLINE); + vty_outln (vty, " Description: %s", plist->desc); } else if (dtype == summary_display || dtype == detail_display) { - vty_out (vty, "ip%s prefix-list %s:%s", - afi == AFI_IP ? "" : "v6", plist->name, VTY_NEWLINE); + vty_outln (vty, "ip%s prefix-list %s:", + afi == AFI_IP ? "" : "v6", plist->name); if (plist->desc) - vty_out (vty, " Description: %s%s", plist->desc, VTY_NEWLINE); + vty_outln (vty, " Description: %s", plist->desc); - vty_out (vty, " count: %d, range entries: %d, sequences: %u - %u%s", + vty_outln (vty, " count: %d, range entries: %d, sequences: %u - %u", plist->count, plist->rangecount, plist->head ? plist->head->seq : 0, - plist->tail ? plist->tail->seq : 0, - VTY_NEWLINE); + plist->tail ? plist->tail->seq : 0); } if (dtype != summary_display) @@ -1235,7 +1234,7 @@ vty_show_prefix_entry (struct vty *vty, afi_t afi, struct prefix_list *plist, vty_out (vty, " (hit count: %ld, refcount: %ld)", pentry->hitcnt, pentry->refcnt); - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); } } } @@ -1260,7 +1259,7 @@ vty_show_prefix_list (struct vty *vty, afi_t afi, const char *name, plist = prefix_list_lookup (afi, name); if (! plist) { - vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE); + vty_outln (vty, "%% Can't find specified prefix-list"); return CMD_WARNING; } vty_show_prefix_entry (vty, afi, plist, master, dtype, seqnum); @@ -1270,8 +1269,8 @@ vty_show_prefix_list (struct vty *vty, afi_t afi, const char *name, if (dtype == detail_display || dtype == summary_display) { if (master->recent) - vty_out (vty, "Prefix-list with the last deletion/insertion: %s%s", - master->recent->name, VTY_NEWLINE); + vty_outln (vty, "Prefix-list with the last deletion/insertion: %s", + master->recent->name); } for (plist = master->num.head; plist; plist = plist->next) @@ -1297,14 +1296,14 @@ vty_show_prefix_list_prefix (struct vty *vty, afi_t afi, const char *name, plist = prefix_list_lookup (afi, name); if (! plist) { - vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE); + vty_outln (vty, "%% Can't find specified prefix-list"); return CMD_WARNING; } ret = str2prefix (prefix, &p); if (ret <= 0) { - vty_out (vty, "%% prefix is malformed%s", VTY_NEWLINE); + vty_outln (vty, "%% prefix is malformed"); return CMD_WARNING; } @@ -1347,7 +1346,7 @@ vty_show_prefix_list_prefix (struct vty *vty, afi_t afi, const char *name, vty_out (vty, " (hit count: %ld, refcount: %ld)", pentry->hitcnt, pentry->refcnt); - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); if (type == first_match_display) return CMD_SUCCESS; @@ -1385,7 +1384,7 @@ vty_clear_prefix_list (struct vty *vty, afi_t afi, const char *name, plist = prefix_list_lookup (afi, name); if (! plist) { - vty_out (vty, "%% Can't find specified prefix-list%s", VTY_NEWLINE); + vty_outln (vty, "%% Can't find specified prefix-list"); return CMD_WARNING; } @@ -1394,7 +1393,7 @@ vty_clear_prefix_list (struct vty *vty, afi_t afi, const char *name, ret = str2prefix (prefix, &p); if (ret <= 0) { - vty_out (vty, "%% prefix is malformed%s", VTY_NEWLINE); + vty_outln (vty, "%% prefix is malformed"); return CMD_WARNING; } } @@ -1819,18 +1818,18 @@ config_write_prefix_afi (afi_t afi, struct vty *vty) if (! master->seqnum) { - vty_out (vty, "no ip%s prefix-list sequence-number%s", - afi == AFI_IP ? "" : "v6", VTY_NEWLINE); - vty_out (vty, "!%s", VTY_NEWLINE); + vty_outln (vty, "no ip%s prefix-list sequence-number", + afi == AFI_IP ? "" : "v6"); + vty_outln (vty, "!"); } for (plist = master->num.head; plist; plist = plist->next) { if (plist->desc) { - vty_out (vty, "ip%s prefix-list %s description %s%s", + vty_outln (vty, "ip%s prefix-list %s description %s", afi == AFI_IP ? "" : "v6", - plist->name, plist->desc, VTY_NEWLINE); + plist->name, plist->desc); write++; } @@ -1861,7 +1860,7 @@ config_write_prefix_afi (afi_t afi, struct vty *vty) if (pentry->le) vty_out (vty, " le %d", pentry->le); } - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); write++; } /* vty_out (vty, "!%s", VTY_NEWLINE); */ @@ -1871,9 +1870,9 @@ config_write_prefix_afi (afi_t afi, struct vty *vty) { if (plist->desc) { - vty_out (vty, "ip%s prefix-list %s description %s%s", + vty_outln (vty, "ip%s prefix-list %s description %s", afi == AFI_IP ? "" : "v6", - plist->name, plist->desc, VTY_NEWLINE); + plist->name, plist->desc); write++; } @@ -1904,7 +1903,7 @@ config_write_prefix_afi (afi_t afi, struct vty *vty) if (pentry->le) vty_out (vty, " le %d", pentry->le); } - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); write++; } } @@ -2049,14 +2048,15 @@ prefix_bgp_show_prefix_list (struct vty *vty, afi_t afi, char *name, u_char use_ else json_object_object_add(json, "ipv6PrefixList", json_prefix); - vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); + vty_outln (vty, "%s", + json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } else { - vty_out (vty, "ip%s prefix-list %s: %d entries%s", + vty_outln (vty, "ip%s prefix-list %s: %d entries", afi == AFI_IP ? "" : "v6", - plist->name, plist->count, VTY_NEWLINE); + plist->name, plist->count); for (pentry = plist->head; pentry; pentry = pentry->next) { @@ -2073,7 +2073,7 @@ prefix_bgp_show_prefix_list (struct vty *vty, afi_t afi, char *name, u_char use_ if (pentry->le) vty_out (vty, " le %d", pentry->le); - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); } } return plist->count; diff --git a/lib/routemap.c b/lib/routemap.c index 7044550db2..a22e7a655d 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -521,12 +521,11 @@ generic_match_add (struct vty *vty, struct route_map_index *index, switch (ret) { case RMAP_RULE_MISSING: - vty_out (vty, "%% [%s] Can't find rule.%s", frr_protonameinst, - VTY_NEWLINE); + vty_outln (vty, "%% [%s] Can't find rule.", frr_protonameinst); return CMD_WARNING; case RMAP_COMPILE_ERROR: - vty_out (vty, "%% [%s] Argument form is unsupported or malformed.%s", - frr_protonameinst, VTY_NEWLINE); + vty_outln (vty, "%% [%s] Argument form is unsupported or malformed.", + frr_protonameinst); return CMD_WARNING; } } @@ -569,8 +568,7 @@ generic_match_delete (struct vty *vty, struct route_map_index *index, switch (ret) { case RMAP_RULE_MISSING: - vty_out (vty, "%% [%s] Can't find rule.%s", frr_protonameinst, - VTY_NEWLINE); + vty_outln (vty, "%% [%s] Can't find rule.%s", frr_protonameinst); break; case RMAP_COMPILE_ERROR: vty_out (vty, "%% [%s] Argument form is unsupported or malformed.%s", @@ -607,12 +605,11 @@ generic_set_add (struct vty *vty, struct route_map_index *index, switch (ret) { case RMAP_RULE_MISSING: - vty_out (vty, "%% [%s] Can't find rule.%s", frr_protonameinst, - VTY_NEWLINE); + vty_outln (vty, "%% [%s] Can't find rule.%s", frr_protonameinst); return CMD_WARNING; case RMAP_COMPILE_ERROR: - vty_out (vty, "%% [%s] Argument form is unsupported or malformed.%s", - frr_protonameinst, VTY_NEWLINE); + vty_outln (vty, "%% [%s] Argument form is unsupported or malformed.", + frr_protonameinst); return CMD_WARNING; } } @@ -631,12 +628,11 @@ generic_set_delete (struct vty *vty, struct route_map_index *index, switch (ret) { case RMAP_RULE_MISSING: - vty_out (vty, "%% [%s] Can't find rule.%s", frr_protonameinst, - VTY_NEWLINE); + vty_outln (vty, "%% [%s] Can't find rule.%s", frr_protonameinst); return CMD_WARNING; case RMAP_COMPILE_ERROR: - vty_out (vty, "%% [%s] Argument form is unsupported or malformed.%s", - frr_protonameinst, VTY_NEWLINE); + vty_outln (vty, "%% [%s] Argument form is unsupported or malformed.%s", + frr_protonameinst); return CMD_WARNING; } } @@ -997,43 +993,43 @@ vty_show_route_map_entry (struct vty *vty, struct route_map *map) struct route_map_index *index; struct route_map_rule *rule; - vty_out (vty, "%s:%s", frr_protonameinst, VTY_NEWLINE); + vty_outln (vty, "%s:", frr_protonameinst); for (index = map->head; index; index = index->next) { - vty_out (vty, "route-map %s, %s, sequence %d%s", + vty_outln (vty, "route-map %s, %s, sequence %d", map->name, route_map_type_str (index->type), - index->pref, VTY_NEWLINE); + index->pref); /* Description */ if (index->description) - vty_out (vty, " Description:%s %s%s", VTY_NEWLINE, - index->description, VTY_NEWLINE); + vty_outln (vty, " Description:%s %s", VTY_NEWLINE, + index->description); /* Match clauses */ - vty_out (vty, " Match clauses:%s", VTY_NEWLINE); + vty_outln (vty, " Match clauses:"); for (rule = index->match_list.head; rule; rule = rule->next) - vty_out (vty, " %s %s%s", - rule->cmd->str, rule->rule_str, VTY_NEWLINE); + vty_outln (vty, " %s %s", + rule->cmd->str, rule->rule_str); - vty_out (vty, " Set clauses:%s", VTY_NEWLINE); + vty_outln (vty, " Set clauses:"); for (rule = index->set_list.head; rule; rule = rule->next) - vty_out (vty, " %s %s%s", - rule->cmd->str, rule->rule_str, VTY_NEWLINE); + vty_outln (vty, " %s %s", + rule->cmd->str, rule->rule_str); /* Call clause */ - vty_out (vty, " Call clause:%s", VTY_NEWLINE); + vty_outln (vty, " Call clause:"); if (index->nextrm) - vty_out (vty, " Call %s%s", index->nextrm, VTY_NEWLINE); + vty_outln (vty, " Call %s", index->nextrm); /* Exit Policy */ - vty_out (vty, " Action:%s", VTY_NEWLINE); + vty_outln (vty, " Action:"); if (index->exitpolicy == RMAP_GOTO) - vty_out (vty, " Goto %d%s", index->nextpref, VTY_NEWLINE); + vty_outln (vty, " Goto %d", index->nextpref); else if (index->exitpolicy == RMAP_NEXT) - vty_out (vty, " Continue to next entry%s", VTY_NEWLINE); + vty_outln (vty, " Continue to next entry"); else if (index->exitpolicy == RMAP_EXIT) - vty_out (vty, " Exit routemap%s", VTY_NEWLINE); + vty_outln (vty, " Exit routemap"); } } @@ -1053,8 +1049,8 @@ vty_show_route_map (struct vty *vty, const char *name) } else { - vty_out (vty, "%s: 'route-map %s' not found%s", frr_protonameinst, - name, VTY_NEWLINE); + vty_outln (vty, "%s: 'route-map %s' not found", frr_protonameinst, + name); return CMD_SUCCESS; } } @@ -2363,14 +2359,14 @@ DEFUN (set_ip_nexthop, ret = str2sockunion (argv[idx_ipv4]->arg, &su); if (ret < 0) { - vty_out (vty, "%% Malformed nexthop address%s", VTY_NEWLINE); + vty_outln (vty, "%% Malformed nexthop address"); return CMD_WARNING; } if (su.sin.sin_addr.s_addr == 0 || IPV4_CLASS_DE(su.sin.sin_addr.s_addr)) { - vty_out (vty, "%% nexthop address cannot be 0.0.0.0, multicast " - "or reserved%s", VTY_NEWLINE); + vty_outln (vty, + "%% nexthop address cannot be 0.0.0.0, multicast " "or reserved"); return CMD_WARNING; } @@ -2420,12 +2416,12 @@ DEFUN (set_ipv6_nexthop_local, ret = inet_pton (AF_INET6, argv[idx_ipv6]->arg, &addr); if (!ret) { - vty_out (vty, "%% Malformed nexthop address%s", VTY_NEWLINE); + vty_outln (vty, "%% Malformed nexthop address"); return CMD_WARNING; } if (!IN6_IS_ADDR_LINKLOCAL(&addr)) { - vty_out (vty, "%% Invalid link-local nexthop address%s", VTY_NEWLINE); + vty_outln (vty, "%% Invalid link-local nexthop address"); return CMD_WARNING; } @@ -2581,7 +2577,7 @@ DEFUN (no_route_map_all, map = route_map_lookup_by_name (mapname); if (map == NULL) { - vty_out (vty, "%% Could not find route-map %s%s", mapname, VTY_NEWLINE); + vty_outln (vty, "%% Could not find route-map %s", mapname); return CMD_WARNING; } @@ -2616,7 +2612,7 @@ DEFUN (no_route_map, map = route_map_lookup_by_name (mapname); if (map == NULL) { - vty_out (vty, "%% Could not find route-map %s%s", mapname, VTY_NEWLINE); + vty_outln (vty, "%% Could not find route-map %s", mapname); return CMD_WARNING; } @@ -2624,8 +2620,8 @@ DEFUN (no_route_map, index = route_map_index_lookup (map, permit, pref); if (index == NULL) { - vty_out (vty, "%% Could not find route-map entry %s %s%s", - mapname, prefstr, VTY_NEWLINE); + vty_outln (vty, "%% Could not find route-map entry %s %s", + mapname, prefstr); return CMD_WARNING; } @@ -2652,8 +2648,7 @@ DEFUN (rmap_onmatch_next, if (index->type == RMAP_DENY) { /* Under a deny clause, match means it's finished. No need to set next */ - vty_out (vty, "on-match next not supported under route-map deny%s", - VTY_NEWLINE); + vty_outln (vty,"on-match next not supported under route-map deny"); return CMD_WARNING; } index->exitpolicy = RMAP_NEXT; @@ -2694,8 +2689,7 @@ DEFUN (rmap_onmatch_goto, if (index->type == RMAP_DENY) { /* Under a deny clause, match means it's finished. No need to go anywhere */ - vty_out (vty, "on-match goto not supported under route-map deny%s", - VTY_NEWLINE); + vty_outln (vty,"on-match goto not supported under route-map deny"); return CMD_WARNING; } @@ -2707,7 +2701,7 @@ DEFUN (rmap_onmatch_goto, if (d <= index->pref) { /* Can't allow you to do that, Dave */ - vty_out (vty, "can't jump backwards in route-maps%s", VTY_NEWLINE); + vty_outln (vty, "can't jump backwards in route-maps"); return CMD_WARNING; } else @@ -2866,33 +2860,31 @@ route_map_config_write (struct vty *vty) for (index = map->head; index; index = index->next) { if (!first) - vty_out (vty, "!%s", VTY_NEWLINE); + vty_outln (vty, "!"); else first = 0; - vty_out (vty, "route-map %s %s %d%s", + vty_outln (vty, "route-map %s %s %d", map->name, route_map_type_str (index->type), - index->pref, VTY_NEWLINE); + index->pref); if (index->description) - vty_out (vty, " description %s%s", index->description, VTY_NEWLINE); + vty_outln (vty, " description %s", index->description); for (rule = index->match_list.head; rule; rule = rule->next) - vty_out (vty, " match %s %s%s", rule->cmd->str, - rule->rule_str ? rule->rule_str : "", - VTY_NEWLINE); + vty_outln (vty, " match %s %s", rule->cmd->str, + rule->rule_str ? rule->rule_str : ""); for (rule = index->set_list.head; rule; rule = rule->next) - vty_out (vty, " set %s %s%s", rule->cmd->str, - rule->rule_str ? rule->rule_str : "", - VTY_NEWLINE); + vty_outln (vty, " set %s %s", rule->cmd->str, + rule->rule_str ? rule->rule_str : ""); if (index->nextrm) - vty_out (vty, " call %s%s", index->nextrm, VTY_NEWLINE); + vty_outln (vty, " call %s", index->nextrm); if (index->exitpolicy == RMAP_GOTO) - vty_out (vty, " on-match goto %d%s", index->nextpref, VTY_NEWLINE); + vty_outln (vty, " on-match goto %d", index->nextpref); if (index->exitpolicy == RMAP_NEXT) - vty_out (vty," on-match next%s", VTY_NEWLINE); + vty_outln (vty," on-match next"); write++; } diff --git a/lib/skiplist.c b/lib/skiplist.c index 05f489c905..5ba1c80e45 100644 --- a/lib/skiplist.c +++ b/lib/skiplist.c @@ -602,11 +602,10 @@ skiplist_debug(struct vty *vty, struct skiplist *l) if (!l) l = skiplist_last_created; - vty_out(vty, "Skiplist %p has max level %d%s", l, l->level, VTY_NEWLINE); + vty_outln (vty, "Skiplist %p has max level %d", l, l->level); for (i = l->level; i >= 0; --i) - vty_out(vty, " @%d: %ld%s", - i, (long)((l->stats->forward[i]) - (struct skiplistnode *)NULL), - VTY_NEWLINE); + vty_outln (vty, " @%d: %ld", + i,(long)((l->stats->forward[i]) - (struct skiplistnode *)NULL)); } static void * diff --git a/lib/smux.c b/lib/smux.c index 032801f6df..86fd9d5484 100644 --- a/lib/smux.c +++ b/lib/smux.c @@ -1387,7 +1387,7 @@ config_write_smux (struct vty *vty) vty_out (vty, "%s%d", first ? "" : ".", (int) smux_oid[i]); first = 0; } - vty_out (vty, " %s%s", smux_passwd, VTY_NEWLINE); + vty_outln (vty, " %s", smux_passwd); } return 0; } diff --git a/lib/spf_backoff.c b/lib/spf_backoff.c index 7e34947344..7cbb300c5f 100644 --- a/lib/spf_backoff.c +++ b/lib/spf_backoff.c @@ -223,44 +223,44 @@ void spf_backoff_show(struct spf_backoff *backoff, struct vty *vty, const char *prefix) { - vty_out(vty, "%sCurrent state: %s%s", prefix, - spf_backoff_state2str(backoff->state), VTY_NEWLINE); - vty_out(vty, "%sInit timer: %ld msec%s", prefix, - backoff->init_delay, VTY_NEWLINE); - vty_out(vty, "%sShort timer: %ld msec%s", prefix, - backoff->short_delay, VTY_NEWLINE); - vty_out(vty, "%sLong timer: %ld msec%s", prefix, - backoff->long_delay, VTY_NEWLINE); - vty_out(vty, "%sHolddown timer: %ld msec%s", prefix, - backoff->holddown, VTY_NEWLINE); + vty_outln (vty, "%sCurrent state: %s", prefix, + spf_backoff_state2str(backoff->state)); + vty_outln (vty, "%sInit timer: %ld msec", prefix, + backoff->init_delay); + vty_outln (vty, "%sShort timer: %ld msec", prefix, + backoff->short_delay); + vty_outln (vty, "%sLong timer: %ld msec", prefix, + backoff->long_delay); + vty_outln (vty, "%sHolddown timer: %ld msec", prefix, + backoff->holddown); if (backoff->t_holddown) { struct timeval remain = thread_timer_remain(backoff->t_holddown); - vty_out(vty, "%s Still runs for %ld msec%s", - prefix, remain.tv_sec * 1000 + remain.tv_usec/1000, VTY_NEWLINE); + vty_outln (vty, "%s Still runs for %ld msec", + prefix, remain.tv_sec * 1000 + remain.tv_usec / 1000); } else { - vty_out(vty, "%s Inactive%s", prefix, VTY_NEWLINE); + vty_outln (vty, "%s Inactive", prefix); } - vty_out(vty, "%sTimeToLearn timer: %ld msec%s", prefix, - backoff->timetolearn, VTY_NEWLINE); + vty_outln (vty, "%sTimeToLearn timer: %ld msec", prefix, + backoff->timetolearn); if (backoff->t_timetolearn) { struct timeval remain = thread_timer_remain(backoff->t_timetolearn); - vty_out(vty, "%s Still runs for %ld msec%s", - prefix, remain.tv_sec * 1000 + remain.tv_usec/1000, VTY_NEWLINE); + vty_outln (vty, "%s Still runs for %ld msec", + prefix, remain.tv_sec * 1000 + remain.tv_usec / 1000); } else { - vty_out(vty, "%s Inactive%s", prefix, VTY_NEWLINE); + vty_outln (vty, "%s Inactive", prefix); } - vty_out(vty, "%sFirst event: %s%s", prefix, - timeval_format(&backoff->first_event_time), VTY_NEWLINE); - vty_out(vty, "%sLast event: %s%s", prefix, - timeval_format(&backoff->last_event_time), VTY_NEWLINE); + vty_outln (vty, "%sFirst event: %s", prefix, + timeval_format(&backoff->first_event_time)); + vty_outln (vty, "%sLast event: %s", prefix, + timeval_format(&backoff->last_event_time)); } DEFUN(spf_backoff_debug, @@ -291,7 +291,7 @@ spf_backoff_write_config(struct vty *vty) if (debug_spf_backoff) { - vty_out(vty, "debug spf-delay-ietf%s", VTY_NEWLINE); + vty_outln (vty, "debug spf-delay-ietf"); written++; } diff --git a/lib/thread.c b/lib/thread.c index 02108bc6bd..a1a9e7c359 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -96,13 +96,13 @@ vty_out_cpu_thread_history(struct vty* vty, a->total_active, a->cpu.total/1000, a->cpu.total%1000, a->total_calls, a->cpu.total/a->total_calls, a->cpu.max, a->real.total/a->total_calls, a->real.max); - vty_out(vty, " %c%c%c%c%c %s%s", + vty_outln (vty, " %c%c%c%c%c %s", a->types & (1 << THREAD_READ) ? 'R':' ', a->types & (1 << THREAD_WRITE) ? 'W':' ', a->types & (1 << THREAD_TIMER) ? 'T':' ', a->types & (1 << THREAD_EVENT) ? 'E':' ', a->types & (1 << THREAD_EXECUTE) ? 'X':' ', - a->funcname, VTY_NEWLINE); + a->funcname); } static void @@ -137,11 +137,11 @@ cpu_record_print(struct vty *vty, thread_type filter) tmp.funcname = "TOTAL"; tmp.types = filter; - vty_out(vty, "%21s %18s %18s%s", - "", "CPU (user+system):", "Real (wall-clock):", VTY_NEWLINE); + vty_outln (vty, "%21s %18s %18s", + "", "CPU (user+system):", "Real (wall-clock):"); vty_out(vty, "Active Runtime(ms) Invoked Avg uSec Max uSecs"); vty_out(vty, " Avg uSec Max uSecs"); - vty_out(vty, " Type Thread%s", VTY_NEWLINE); + vty_outln (vty, " Type Thread"); pthread_mutex_lock (&cpu_record_mtx); { @@ -201,9 +201,9 @@ DEFUN (show_thread_cpu, } if (filter == 0) { - vty_out(vty, "Invalid filter \"%s\" specified," - " must contain at least one of 'RWTEXB'%s", - argv[idx_filter]->arg, VTY_NEWLINE); + vty_outln (vty, "Invalid filter \"%s\" specified," + " must contain at least one of 'RWTEXB'", + argv[idx_filter]->arg); return CMD_WARNING; } } @@ -289,9 +289,9 @@ DEFUN (clear_thread_cpu, } if (filter == 0) { - vty_out(vty, "Invalid filter \"%s\" specified," - " must contain at least one of 'RWTEXB'%s", - argv[idx_filter]->arg, VTY_NEWLINE); + vty_outln (vty, "Invalid filter \"%s\" specified," + " must contain at least one of 'RWTEXB'", + argv[idx_filter]->arg); return CMD_WARNING; } } @@ -555,7 +555,7 @@ static int vrf_write_host (struct vty *vty) { if (debug_vrf) - vty_out (vty, "debug vrf%s", VTY_NEWLINE); + vty_outln (vty, "debug vrf"); return 1; } @@ -263,12 +263,12 @@ vty_hello (struct vty *vty) for (s = buf + strlen (buf); (s > buf) && isspace ((int)*(s - 1)); s--); *s = '\0'; - vty_out (vty, "%s%s", buf, VTY_NEWLINE); + vty_outln (vty, "%s", buf); } fclose (f); } else - vty_out (vty, "MOTD file not found%s", VTY_NEWLINE); + vty_outln (vty, "MOTD file not found"); } else if (host.motd) vty_out (vty, "%s", host.motd); @@ -401,14 +401,14 @@ vty_auth (struct vty *vty, char *buf) { if (vty->node == AUTH_NODE) { - vty_out (vty, "%% Bad passwords, too many failures!%s", VTY_NEWLINE); + vty_outln (vty, "%% Bad passwords, too many failures!"); vty->status = VTY_CLOSE; } else { /* AUTH_ENABLE_NODE */ vty->fail = 0; - vty_out (vty, "%% Bad enable passwords, too many failures!%s", VTY_NEWLINE); + vty_outln (vty, "%% Bad enable passwords, too many failures!"); vty->status = VTY_CLOSE; } } @@ -493,16 +493,16 @@ vty_command (struct vty *vty, char *buf) { case CMD_WARNING: if (vty->type == VTY_FILE) - vty_out (vty, "Warning...%s", VTY_NEWLINE); + vty_outln (vty, "Warning..."); break; case CMD_ERR_AMBIGUOUS: - vty_out (vty, "%% Ambiguous command.%s", VTY_NEWLINE); + vty_outln (vty, "%% Ambiguous command."); break; case CMD_ERR_NO_MATCH: - vty_out (vty, "%% [%s] Unknown command: %s%s", protocolname, buf, VTY_NEWLINE); + vty_outln (vty, "%% [%s] Unknown command: %s", protocolname, buf); break; case CMD_ERR_INCOMPLETE: - vty_out (vty, "%% Command incomplete.%s", VTY_NEWLINE); + vty_outln (vty, "%% Command incomplete."); break; } cmd_free_strvec (vline); @@ -730,7 +730,7 @@ vty_backward_word (struct vty *vty) static void vty_down_level (struct vty *vty) { - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); cmd_exit (vty); vty_prompt (vty); vty->cp = 0; @@ -740,7 +740,7 @@ vty_down_level (struct vty *vty) static void vty_end_config (struct vty *vty) { - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); switch (vty->node) { @@ -945,11 +945,11 @@ vty_complete_command (struct vty *vty) cmd_free_strvec (vline); - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); switch (ret) { case CMD_ERR_AMBIGUOUS: - vty_out (vty, "%% Ambiguous command.%s", VTY_NEWLINE); + vty_outln (vty, "%% Ambiguous command."); vty_prompt (vty); vty_redraw_line (vty); break; @@ -962,7 +962,7 @@ vty_complete_command (struct vty *vty) if (!matched[0]) { /* 2016-11-28 equinox -- need to debug, SEGV here */ - vty_out (vty, "%% CLI BUG: FULL_MATCH with NULL str%s", VTY_NEWLINE); + vty_outln (vty, "%% CLI BUG: FULL_MATCH with NULL str"); vty_prompt (vty); vty_redraw_line (vty); break; @@ -985,11 +985,11 @@ vty_complete_command (struct vty *vty) for (i = 0; matched[i] != NULL; i++) { if (i != 0 && ((i % 6) == 0)) - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); vty_out (vty, "%-10s ", matched[i]); XFREE (MTYPE_COMPLETION, matched[i]); } - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); vty_prompt (vty); vty_redraw_line (vty); @@ -1017,7 +1017,7 @@ vty_describe_fold (struct vty *vty, int cmd_width, if (desc_width <= 0) { - vty_out (vty, " %-*s %s%s", cmd_width, cmd, token->desc, VTY_NEWLINE); + vty_outln (vty, " %-*s %s", cmd_width, cmd, token->desc); return; } @@ -1034,12 +1034,12 @@ vty_describe_fold (struct vty *vty, int cmd_width, strncpy (buf, p, pos); buf[pos] = '\0'; - vty_out (vty, " %-*s %s%s", cmd_width, cmd, buf, VTY_NEWLINE); + vty_outln (vty, " %-*s %s", cmd_width, cmd, buf); cmd = ""; } - vty_out (vty, " %-*s %s%s", cmd_width, cmd, p, VTY_NEWLINE); + vty_outln (vty, " %-*s %s", cmd_width, cmd, p); XFREE (MTYPE_TMP, buf); } @@ -1068,17 +1068,17 @@ vty_describe_command (struct vty *vty) describe = cmd_describe_command (vline, vty, &ret); - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); /* Ambiguous error. */ switch (ret) { case CMD_ERR_AMBIGUOUS: - vty_out (vty, "%% Ambiguous command.%s", VTY_NEWLINE); + vty_outln (vty, "%% Ambiguous command."); goto out; break; case CMD_ERR_NO_MATCH: - vty_out (vty, "%% There is no matched command.%s", VTY_NEWLINE); + vty_outln (vty, "%% There is no matched command."); goto out; break; } @@ -1116,13 +1116,12 @@ vty_describe_command (struct vty *vty) } if (!token->desc) - vty_out (vty, " %-s%s", - token->text, - VTY_NEWLINE); + vty_outln (vty, " %-s", + token->text); else if (desc_width >= strlen (token->desc)) - vty_out (vty, " %-*s %s%s", width, + vty_outln (vty, " %-*s %s", width, token->text, - token->desc, VTY_NEWLINE); + token->desc); else vty_describe_fold (vty, width, desc_width, token); @@ -1142,7 +1141,7 @@ vty_describe_command (struct vty *vty) vty_out(vty, " %s", item); XFREE(MTYPE_COMPLETION, item); } - vty_out(vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); } vector_free(varcomps); } @@ -1156,13 +1155,12 @@ vty_describe_command (struct vty *vty) if ((token = token_cr)) { if (!token->desc) - vty_out (vty, " %-s%s", - token->text, - VTY_NEWLINE); + vty_outln (vty, " %-s", + token->text); else if (desc_width >= strlen (token->desc)) - vty_out (vty, " %-*s %s%s", width, + vty_outln (vty, " %-*s %s", width, token->text, - token->desc, VTY_NEWLINE); + token->desc); else vty_describe_fold (vty, width, desc_width, token); } @@ -1188,7 +1186,7 @@ vty_stop_input (struct vty *vty) { vty->cp = vty->length = 0; vty_clear_buf (vty); - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); switch (vty->node) { @@ -1299,20 +1297,20 @@ vty_telnet_option (struct vty *vty, unsigned char *buf, int nbytes) vty_out (vty, "SE "); break; case TELOPT_ECHO: - vty_out (vty, "TELOPT_ECHO %s", VTY_NEWLINE); + vty_outln (vty, "TELOPT_ECHO "); break; case TELOPT_SGA: - vty_out (vty, "TELOPT_SGA %s", VTY_NEWLINE); + vty_outln (vty, "TELOPT_SGA "); break; case TELOPT_NAWS: - vty_out (vty, "TELOPT_NAWS %s", VTY_NEWLINE); + vty_outln (vty, "TELOPT_NAWS "); break; default: vty_out (vty, "%x ", buf[i]); break; } } - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); #endif /* TELNET_OPTION_DEBUG */ @@ -1349,9 +1347,9 @@ vty_telnet_option (struct vty *vty, unsigned char *buf, int nbytes) vty->width = ((vty->sb_buf[1] << 8)|vty->sb_buf[2]); vty->height = ((vty->sb_buf[3] << 8)|vty->sb_buf[4]); #ifdef TELNET_OPTION_DEBUG - vty_out(vty, "TELNET NAWS window size negotiation completed: " - "width %d, height %d%s", - vty->width, vty->height, VTY_NEWLINE); + vty_outln (vty, "TELNET NAWS window size negotiation completed: " + "width %d, height %d", + vty->width, vty->height); #endif } break; @@ -1608,7 +1606,7 @@ vty_read (struct thread *thread) break; case '\n': case '\r': - vty_out (vty, "%s", VTY_NEWLINE); + vty_outln (vty, ""); vty_execute (vty); break; case '\t': @@ -1767,7 +1765,7 @@ vty_create (int vty_sock, union sockunion *su) /* Vty is not available if password isn't set. */ if (host.password == NULL && host.password_encrypt == NULL) { - vty_out (vty, "Vty password is not set.%s", VTY_NEWLINE); + vty_outln (vty, "Vty password is not set."); vty->status = VTY_CLOSE; vty_close (vty); return NULL; @@ -1777,7 +1775,8 @@ vty_create (int vty_sock, union sockunion *su) /* Say hello to the world. */ vty_hello (vty); if (! no_password_check) - vty_out (vty, "%sUser Access Verification%s%s", VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); + vty_outln (vty, "%sUser Access Verification%s", VTY_NEWLINE, + VTY_NEWLINE); /* Setting up terminal. */ vty_will_echo (vty); @@ -2194,7 +2193,7 @@ vtysh_read (struct thread *thread) /* Clear command line buffer. */ vty->cp = vty->length = 0; vty_clear_buf (vty); - vty_out (vty, "%% Command is too long.%s", VTY_NEWLINE); + vty_outln (vty, "%% Command is too long."); } else { @@ -2337,7 +2336,7 @@ vty_timeout (struct thread *thread) /* Clear buffer*/ buffer_reset (vty->obuf); - vty_out (vty, "%sVty connection is timed out.%s", VTY_NEWLINE, VTY_NEWLINE); + vty_outln (vty, "%sVty connection is timed out.", VTY_NEWLINE); /* Close connection. */ vty->status = VTY_CLOSE; @@ -2818,8 +2817,7 @@ DEFUN (no_vty_access_class, const char *accesslist = (argc == 3) ? argv[idx_word]->arg : NULL; if (! vty_accesslist_name || (argc == 3 && strcmp(vty_accesslist_name, accesslist))) { - vty_out (vty, "Access-class is not currently applied to vty%s", - VTY_NEWLINE); + vty_outln (vty,"Access-class is not currently applied to vty"); return CMD_WARNING; } @@ -2862,8 +2860,7 @@ DEFUN (no_vty_ipv6_access_class, if (! vty_ipv6_accesslist_name || (argc == 4 && strcmp(vty_ipv6_accesslist_name, accesslist))) { - vty_out (vty, "IPv6 access-class is not currently applied to vty%s", - VTY_NEWLINE); + vty_outln (vty,"IPv6 access-class is not currently applied to vty"); return CMD_WARNING; } @@ -2987,30 +2984,30 @@ DEFUN (log_commands, static int vty_config_write (struct vty *vty) { - vty_out (vty, "line vty%s", VTY_NEWLINE); + vty_outln (vty, "line vty"); if (vty_accesslist_name) - vty_out (vty, " access-class %s%s", - vty_accesslist_name, VTY_NEWLINE); + vty_outln (vty, " access-class %s", + vty_accesslist_name); if (vty_ipv6_accesslist_name) - vty_out (vty, " ipv6 access-class %s%s", - vty_ipv6_accesslist_name, VTY_NEWLINE); + vty_outln (vty, " ipv6 access-class %s", + vty_ipv6_accesslist_name); /* exec-timeout */ if (vty_timeout_val != VTY_TIMEOUT_DEFAULT) - vty_out (vty, " exec-timeout %ld %ld%s", + vty_outln (vty, " exec-timeout %ld %ld", vty_timeout_val / 60, - vty_timeout_val % 60, VTY_NEWLINE); + vty_timeout_val % 60); /* login */ if (no_password_check) - vty_out (vty, " no login%s", VTY_NEWLINE); + vty_outln (vty, " no login"); if (do_log_commands) - vty_out (vty, "log commands%s", VTY_NEWLINE); + vty_outln (vty, "log commands"); - vty_out (vty, "!%s", VTY_NEWLINE); + vty_outln (vty, "!"); return CMD_SUCCESS; } diff --git a/lib/workqueue.c b/lib/workqueue.c index 8a06502894..3749344196 100644 --- a/lib/workqueue.c +++ b/lib/workqueue.c @@ -191,23 +191,21 @@ DEFUN (show_work_queues, struct listnode *node; struct work_queue *wq; - vty_out (vty, - "%c %8s %5s %8s %8s %21s%s", - ' ', "List","(ms) ","Q. Runs","Yields","Cycle Counts ", - VTY_NEWLINE); - vty_out (vty, - "%c %8s %5s %8s %8s %7s %6s %8s %6s %s%s", + vty_outln (vty, + "%c %8s %5s %8s %8s %21s", + ' ', "List","(ms) ","Q. Runs","Yields","Cycle Counts "); + vty_outln (vty, + "%c %8s %5s %8s %8s %7s %6s %8s %6s %s", 'P', "Items", "Hold", "Total","Total", "Best","Gran.","Total","Avg.", - "Name", - VTY_NEWLINE); + "Name"); for (ALL_LIST_ELEMENTS_RO (work_queues, node, wq)) { - vty_out (vty,"%c %8d %5d %8ld %8ld %7d %6d %8ld %6u %s%s", + vty_outln (vty,"%c %8d %5d %8ld %8ld %7d %6d %8ld %6u %s", (CHECK_FLAG (wq->flags, WQ_UNPLUGGED) ? ' ' : 'P'), listcount (wq->items), wq->spec.hold, @@ -215,8 +213,7 @@ DEFUN (show_work_queues, wq->cycles.best, wq->cycles.granularity, wq->cycles.total, (wq->runs) ? (unsigned int) (wq->cycles.total / wq->runs) : 0, - wq->name, - VTY_NEWLINE); + wq->name); } return CMD_SUCCESS; |
