external/mambo: Add support for readline if it exists

Message ID 20180502050802.15191-1-bsingharora@gmail.com
State Accepted
Headers show
Series
  • external/mambo: Add support for readline if it exists
Related show

Commit Message

Balbir Singh May 2, 2018, 5:08 a.m.
Add support for tclreadline package if it is present.
This patch loads the package and uses it when the
simulation stops for any reason.

Signed-off-by: Balbir Singh <bsingharora@gmail.com>
---
 external/mambo/skiboot.tcl | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

Comments

Stewart Smith May 25, 2018, 12:24 a.m. | #1
Balbir Singh <bsingharora@gmail.com> writes:
> Add support for tclreadline package if it is present.
> This patch loads the package and uses it when the
> simulation stops for any reason.
>
> Signed-off-by: Balbir Singh <bsingharora@gmail.com>
> ---
>  external/mambo/skiboot.tcl | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)

Merged to master as of 8cbe91569112a7ee5b741fcdee72f8195fdbb59b

Patch

diff --git a/external/mambo/skiboot.tcl b/external/mambo/skiboot.tcl
index 38298bff..078f4b65 100644
--- a/external/mambo/skiboot.tcl
+++ b/external/mambo/skiboot.tcl
@@ -1,6 +1,17 @@ 
 # need to get images path defined early
 source $env(LIB_DIR)/ppc/util.tcl
 
+#
+# Call tclreadline's Loop to move to friendlier
+# commandline if one exists
+#
+proc readline { } {
+    set readline [catch { package require tclreadline }]
+    if { $readline == 0 } {
+        ::tclreadline::Loop
+    }
+}
+
 proc mconfig { name env_name def } {
     global mconf
     global env
@@ -481,5 +492,7 @@  epapr::of2dtb mysim $mconf(epapr_dt_addr)
 mysim mode fastest
 
 if { [info exists env(SKIBOOT_AUTORUN)] } {
-    mysim go
+    if [catch { mysim go }] {
+	readline
+    }
 }