[vtysh] Make vtysh more useable for scripting

Add environment variable (VTYSH_LOG) for logging.
If a command fails, exit with non-zero exit code and don't
continue multipart commands.
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index 32b626c..20f7df4 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -272,10 +272,10 @@
 }
 
 /* Command execution over the vty interface. */
-static void
+static int
 vtysh_execute_func (const char *line, int pager)
 {
-  int ret, cmd_stat;
+  int ret, cmd_stat = CMD_SUCCESS;
   u_int i;
   vector vline;
   struct cmd_element *cmd;
@@ -288,7 +288,7 @@
   vline = cmd_make_strvec (line);
 
   if (vline == NULL)
-    return;
+    return CMD_SUCCESS;
 
   saved_ret = ret = cmd_execute_command (vline, vty, &cmd, 1);
   saved_node = vty->node;
@@ -394,7 +394,7 @@
 			  }
 			fp = NULL;
 		      }
-		    return;
+		    return CMD_SUCCESS;
 		  }
 
 		ret = cmd_execute_command (vline, vty, &cmd, 1);
@@ -435,18 +435,19 @@
 	}
       fp = NULL;
     }
+  return cmd_stat;
 }
 
-void
+int
 vtysh_execute_no_pager (const char *line)
 {
-  vtysh_execute_func (line, 0);
+  return vtysh_execute_func (line, 0);
 }
 
-void
+int
 vtysh_execute (const char *line)
 {
-  vtysh_execute_func (line, 1);
+  return vtysh_execute_func (line, 1);
 }
 
 /* Configration make from file. */