[prev in list] [next in list] [prev in thread] [next in thread] 

List:       quagga-dev
Subject:    [quagga-dev 6227] [PATCH 11/21] Return non-zero exit code on error.
From:       Stephen Hemminger <shemminger () vyatta ! com>
Date:       2008-07-28 22:04:56
Message-ID: 20081201231212.878050902 () vyatta ! com
[Download RAW message or body]

Vtysh would ignore errors and always suceed which makes it hard
to use in scripts.
If passed a bad command, return non-zero exit code
---
 vtysh/vtysh.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index 20f7df4..bff0632 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -275,7 +275,7 @@ vtysh_pager_init (void)
 static int
 vtysh_execute_func (const char *line, int pager)
 {
-  int ret, cmd_stat = CMD_SUCCESS;
+  int ret, cmd_stat;
   u_int i;
   vector vline;
   struct cmd_element *cmd;
@@ -336,6 +336,7 @@ vtysh_execute_func (const char *line, int pager)
 
   cmd_free_strvec (vline);
 
+  cmd_stat = ret;
   switch (ret)
     {
     case CMD_WARNING:
-- 
1.5.4.3


_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
http://lists.quagga.net/mailman/listinfo/quagga-dev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic