summaryrefslogtreecommitdiff
path: root/lib/command.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2017-07-13 17:49:13 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2017-07-13 20:29:22 +0200
commit5c7571d43f57317b0827ac82fbebc4cdc6865be0 (patch)
tree2bc63ccbd805abc9689e9f3345e34871558d5c26 /lib/command.c
parent83eba583d7be5afaf2eba35ce4d391f645af4bfa (diff)
*: ditch vty_outln(), part 1 of 2
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c100
1 files changed, 50 insertions, 50 deletions
diff --git a/lib/command.c b/lib/command.c
index 5ca4a0fda9..fb560cb614 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -433,27 +433,27 @@ static int
config_write_host (struct vty *vty)
{
if (host.name)
- vty_outln (vty, "hostname %s", host.name);
+ vty_out (vty, "hostname %s\n", host.name);
if (host.encrypt)
{
if (host.password_encrypt)
- vty_outln (vty, "password 8 %s", host.password_encrypt);
+ vty_out (vty, "password 8 %s\n", host.password_encrypt);
if (host.enable_encrypt)
- vty_outln (vty, "enable password 8 %s", host.enable_encrypt);
+ vty_out (vty, "enable password 8 %s\n", host.enable_encrypt);
}
else
{
if (host.password)
- vty_outln (vty, "password %s", host.password);
+ vty_out (vty, "password %s\n", host.password);
if (host.enable)
- vty_outln (vty, "enable password %s", host.enable);
+ vty_out (vty, "enable password %s\n", host.enable);
}
if (zlog_default->default_lvl != LOG_DEBUG)
{
- vty_outln (vty,"! N.B. The 'log trap' command is deprecated.");
- vty_outln (vty, "log trap %s",
+ vty_out (vty,"! N.B. The 'log trap' command is deprecated.\n");
+ vty_out (vty, "log trap %s\n",
zlog_priority[zlog_default->default_lvl]);
}
@@ -476,9 +476,9 @@ config_write_host (struct vty *vty)
}
if (zlog_default->maxlvl[ZLOG_DEST_MONITOR] == ZLOG_DISABLED)
- vty_outln (vty,"no log monitor");
+ vty_out (vty,"no log monitor\n");
else if (zlog_default->maxlvl[ZLOG_DEST_MONITOR] != zlog_default->default_lvl)
- vty_outln (vty,"log monitor %s",
+ vty_out (vty,"log monitor %s\n",
zlog_priority[zlog_default->maxlvl[ZLOG_DEST_MONITOR]]);
if (zlog_default->maxlvl[ZLOG_DEST_SYSLOG] != ZLOG_DISABLED)
@@ -491,29 +491,29 @@ config_write_host (struct vty *vty)
}
if (zlog_default->facility != LOG_DAEMON)
- vty_outln (vty, "log facility %s",
+ vty_out (vty, "log facility %s\n",
facility_name(zlog_default->facility));
if (zlog_default->record_priority == 1)
- vty_outln (vty, "log record-priority");
+ vty_out (vty, "log record-priority\n");
if (zlog_default->timestamp_precision > 0)
- vty_outln (vty, "log timestamp precision %d",
+ vty_out (vty, "log timestamp precision %d\n",
zlog_default->timestamp_precision);
if (host.advanced)
- vty_outln (vty, "service advanced-vty");
+ vty_out (vty, "service advanced-vty\n");
if (host.encrypt)
- vty_outln (vty, "service password-encryption");
+ vty_out (vty, "service password-encryption\n");
if (host.lines >= 0)
- vty_outln (vty, "service terminal-length %d",host.lines);
+ vty_out (vty, "service terminal-length %d\n",host.lines);
if (host.motdfile)
- vty_outln (vty, "banner motd file %s", host.motdfile);
+ vty_out (vty, "banner motd file %s\n", host.motdfile);
else if (! host.motd)
- vty_outln (vty, "no banner motd");
+ vty_out (vty, "no banner motd\n");
return 1;
}
@@ -1149,7 +1149,7 @@ DEFUN (config_terminal,
vty->node = CONFIG_NODE;
else
{
- vty_outln (vty, "VTY configuration is locked by other VTY");
+ vty_out (vty, "VTY configuration is locked by other VTY\n");
return CMD_WARNING;
}
return CMD_SUCCESS;
@@ -1346,10 +1346,10 @@ DEFUN (show_version,
SHOW_STR
"Displays zebra version\n")
{
- vty_outln (vty, "%s %s (%s).", FRR_FULL_NAME, FRR_VERSION,
+ vty_out (vty, "%s %s (%s).\n", 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", VTYNL,
+ vty_out (vty, "%s%s\n", FRR_COPYRIGHT, GIT_INFO);
+ vty_out (vty, "configured with:%s %s\n", VTYNL,
FRR_CONFIG_ARGS);
return CMD_SUCCESS;
@@ -1373,7 +1373,7 @@ DEFUN (config_help,
"help",
"Description of the interactive help system\n")
{
- vty_outln (vty,
+ vty_out (vty,
"Quagga VTY provides advanced help feature. When you need help,%s\
anytime at the command line please press '?'.%s\
%s\
@@ -1385,7 +1385,7 @@ 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", VTYNL, VTYNL, VTYNL,
+ (e.g. 'show me?'.)%s\n", VTYNL, VTYNL, VTYNL,
VTYNL, VTYNL, VTYNL, VTYNL, VTYNL,
VTYNL, VTYNL, VTYNL, VTYNL);
return CMD_SUCCESS;
@@ -1455,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_outln (vty, " %s", element->string);
+ vty_out (vty, " %s\n", element->string);
}
return CMD_SUCCESS;
}
@@ -1488,25 +1488,25 @@ vty_write_config (struct vty *vty)
if (vty->type == VTY_TERM)
{
- vty_outln (vty, "%sCurrent configuration:",VTYNL);
- vty_outln (vty, "!");
+ vty_out (vty, "%sCurrent configuration:\n",VTYNL);
+ vty_out (vty, "!\n");
}
- vty_outln (vty, "frr version %s", FRR_VER_SHORT);
- vty_outln (vty, "frr defaults %s", DFLT_NAME);
- vty_outln (vty, "!");
+ vty_out (vty, "frr version %s\n", FRR_VER_SHORT);
+ vty_out (vty, "frr defaults %s\n", DFLT_NAME);
+ vty_out (vty, "!\n");
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_outln (vty, "!");
+ vty_out (vty, "!\n");
}
if (vty->type == VTY_TERM)
{
- vty_outln (vty, "end");
+ vty_out (vty, "end\n");
}
}
@@ -1543,7 +1543,7 @@ DEFUN (config_write,
/* Check and see if we are operating under vtysh configuration */
if (host.config == NULL)
{
- vty_outln (vty,"Can't save to configuration file, using vtysh.");
+ vty_out (vty,"Can't save to configuration file, using vtysh.\n");
return CMD_WARNING;
}
@@ -1578,12 +1578,12 @@ DEFUN (config_write,
fd = mkstemp (config_file_tmp);
if (fd < 0)
{
- vty_outln (vty, "Can't open configuration file %s.",config_file_tmp);
+ vty_out (vty, "Can't open configuration file %s.\n",config_file_tmp);
goto finished;
}
if (fchmod (fd, CONFIGFILE_MASK) != 0)
{
- vty_outln (vty, "Can't chmod configuration file %s: %s (%d).",
+ vty_out (vty, "Can't chmod configuration file %s: %s (%d).\n",
config_file_tmp, safe_strerror(errno), errno);
goto finished;
}
@@ -1605,13 +1605,13 @@ DEFUN (config_write,
if (unlink (config_file_sav) != 0)
if (errno != ENOENT)
{
- vty_outln (vty, "Can't unlink backup configuration file %s.",
+ vty_out (vty, "Can't unlink backup configuration file %s.\n",
config_file_sav);
goto finished;
}
if (link (config_file, config_file_sav) != 0)
{
- vty_outln (vty, "Can't backup old configuration file %s.",
+ vty_out (vty, "Can't backup old configuration file %s.\n",
config_file_sav);
goto finished;
}
@@ -1620,13 +1620,13 @@ DEFUN (config_write,
}
if (rename (config_file_tmp, config_file) != 0)
{
- vty_outln (vty, "Can't save configuration file %s.",config_file);
+ vty_out (vty, "Can't save configuration file %s.\n",config_file);
goto finished;
}
if (dirfd >= 0)
fsync (dirfd);
- vty_outln (vty, "Configuration saved to %s",config_file);
+ vty_out (vty, "Configuration saved to %s\n",config_file);
ret = CMD_SUCCESS;
finished:
@@ -1681,7 +1681,7 @@ DEFUN (show_startup_config,
confp = fopen (host.config, "r");
if (confp == NULL)
{
- vty_outln (vty, "Can't open configuration file [%s] due to '%s'",
+ vty_out (vty, "Can't open configuration file [%s] due to '%s'\n",
host.config, safe_strerror(errno));
return CMD_WARNING;
}
@@ -1694,7 +1694,7 @@ DEFUN (show_startup_config,
cp++;
*cp = '\0';
- vty_outln (vty, "%s", buf);
+ vty_out (vty, "%s\n", buf);
}
fclose (confp);
@@ -1721,7 +1721,7 @@ DEFUN (config_hostname,
if (!isalpha((int) word->arg[0]))
{
- vty_outln (vty, "Please specify string starting with alphabet");
+ vty_out (vty, "Please specify string starting with alphabet\n");
return CMD_WARNING;
}
@@ -1761,8 +1761,8 @@ DEFUN (config_password,
if (!isalnum (argv[idx_8]->arg[0]))
{
- vty_outln (vty,
- "Please specify string starting with alphanumeric");
+ vty_out (vty,
+ "Please specify string starting with alphanumeric\n");
return CMD_WARNING;
}
@@ -1811,15 +1811,15 @@ DEFUN (config_enable_password,
}
else
{
- vty_outln (vty, "Unknown encryption type.");
+ vty_out (vty, "Unknown encryption type.\n");
return CMD_WARNING;
}
}
if (!isalnum (argv[idx_8]->arg[0]))
{
- vty_outln (vty,
- "Please specify string starting with alphanumeric");
+ vty_out (vty,
+ "Please specify string starting with alphanumeric\n");
return CMD_WARNING;
}
@@ -1968,7 +1968,7 @@ DEFUN_HIDDEN (do_echo,
{
char *message;
- vty_outln (vty, "%s",
+ vty_out (vty, "%s\n",
((message = argv_concat(argv, argc, 1)) ? message : ""));
if (message)
XFREE(MTYPE_TMP, message);
@@ -2040,11 +2040,11 @@ DEFUN (show_logging,
zl->filename);
vty_out (vty, VTYNL);
- vty_outln (vty, "Protocol name: %s",
+ vty_out (vty, "Protocol name: %s\n",
zl->protoname);
- vty_outln (vty, "Record priority: %s",
+ vty_out (vty, "Record priority: %s\n",
(zl->record_priority ? "enabled" : "disabled"));
- vty_outln (vty, "Timestamp precision: %d",
+ vty_out (vty, "Timestamp precision: %d\n",
zl->timestamp_precision);
return CMD_SUCCESS;