veyron/tools/naming/simulator: add support for printing out json dicts.

Change-Id: Ib9b6852151d31911b9adcf74135c5de90f2b1087
diff --git a/tools/naming/simulator/driver.go b/tools/naming/simulator/driver.go
index 31e6038..c6abba2 100644
--- a/tools/naming/simulator/driver.go
+++ b/tools/naming/simulator/driver.go
@@ -33,11 +33,13 @@
 var (
 	interactive bool
 	handles     map[string]*cmdState
+	jsonDict    map[string]string
 )
 
 func init() {
 	flag.BoolVar(&interactive, "interactive", true, "set interactive/batch mode")
 	handles = make(map[string]*cmdState)
+	jsonDict = make(map[string]string)
 	flag.Usage = usage
 }
 
@@ -126,7 +128,9 @@
 			}
 			if err := process(shell, line, lineno); err != nil {
 				fmt.Printf("ERROR: %d> %q: %v\n", lineno, line, err)
-				os.Exit(1)
+				if !interactive {
+					os.Exit(1)
+				}
 			}
 		}
 		shell.SetVar("_", strconv.Itoa(lineno))
@@ -194,11 +198,8 @@
 			expect.NewSession(nil, handle.Stdout(), time.Minute),
 			line,
 		}
-		if !interactive {
-			fmt.Printf("%d> %s\n", lineno, line)
-		}
+		output(lineno, line)
 	}
-
 	return nil
 }