summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/vtysh.12
-rw-r--r--vtysh/ChangeLog7
-rw-r--r--vtysh/vtysh_main.c22
3 files changed, 24 insertions, 7 deletions
diff --git a/doc/vtysh.1 b/doc/vtysh.1
index 30c03c89..7422fa5e 100644
--- a/doc/vtysh.1
+++ b/doc/vtysh.1
@@ -19,7 +19,7 @@ routing engine.
.SH OPTIONS
.TP
-\fB\-e
+\fB\-c
Specify command to be executed under batch mode.
diff --git a/vtysh/ChangeLog b/vtysh/ChangeLog
index f4bf9341..8e2875bf 100644
--- a/vtysh/ChangeLog
+++ b/vtysh/ChangeLog
@@ -1,3 +1,10 @@
+2004-04-06 Hasso Tepper <hasso@estpak.ee>
+
+ * vtysh_main.c: Don't save command to history if last command already
+ there is same.
+ * vtysh_main.c: Replace -e with -c.
+ * vtysh_main.c: Fix help.
+
2004-03-04 Hasso Tepper <hasso@estpak.ee>
* vtysh.c: Remove using PAGER.
diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c
index ee092458..047e21e9 100644
--- a/vtysh/vtysh_main.c
+++ b/vtysh/vtysh_main.c
@@ -144,10 +144,9 @@ usage (int status)
else
{
printf ("Usage : %s [OPTION...]\n\n\
-Daemon which manages kernel routing table management and \
-redistribution between different routing protocols.\n\n\
+Integrated shell for Quagga routing software suite. \n\n\
-b, --boot Execute boot startup configuration\n\
--e, --eval Execute argument as command\n\
+-c, --command Execute argument as command\n\
-h, --help Display this help and exit\n\
\n\
Report bugs to %s\n", progname, ZEBRA_BUG_ADDRESS);
@@ -159,7 +158,9 @@ Report bugs to %s\n", progname, ZEBRA_BUG_ADDRESS);
struct option longopts[] =
{
{ "boot", no_argument, NULL, 'b'},
+ /* For compatibility with older zebra/quagga versions */
{ "eval", required_argument, NULL, 'e'},
+ { "command", required_argument, NULL, 'c'},
{ "help", no_argument, NULL, 'h'},
{ 0 }
};
@@ -168,6 +169,7 @@ struct option longopts[] =
char *
vtysh_rl_gets ()
{
+ HIST_ENTRY *last;
/* If the buffer has already been allocated, return the memory
to the free pool. */
if (line_read)
@@ -179,9 +181,16 @@ vtysh_rl_gets ()
/* Get a line from the user. Change prompt according to node. XXX. */
line_read = readline (vtysh_prompt ());
- /* If the line has any text in it, save it on the history. */
+ /* If the line has any text in it, save it on the history. But only if
+ * last command in history isn't the same one.
+ */
if (line_read && *line_read)
- add_history (line_read);
+ {
+ using_history();
+ last = previous_history();
+ if (!last || strcmp (last->line, line_read) != 0)
+ add_history (line_read);
+ }
return (line_read);
}
@@ -203,7 +212,7 @@ main (int argc, char **argv, char **env)
/* Option handling. */
while (1)
{
- opt = getopt_long (argc, argv, "be:h", longopts, 0);
+ opt = getopt_long (argc, argv, "be:c:h", longopts, 0);
if (opt == EOF)
break;
@@ -216,6 +225,7 @@ main (int argc, char **argv, char **env)
boot_flag = 1;
break;
case 'e':
+ case 'c':
eval_flag = 1;
eval_line = optarg;
break;