From e6ccf6badff071dba517b6e54131705951f251a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Izaguirre?= Date: Sat, 7 Aug 2021 23:50:24 +0200 Subject: [PATCH] *HOST --- osCLI.go | 15 +++++++++++++++ osWord.go | 2 -- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/osCLI.go b/osCLI.go index 0144d2f..9009909 100644 --- a/osCLI.go +++ b/osCLI.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "os/exec" "strconv" "strings" ) @@ -35,8 +36,22 @@ func execOSCLI(env *environment) { switch command { case "*HELP": msg = "\nbbz - Acorn MOS for 6502 adaptation layer, https://github.com/ivanizag/bbz\n" + case "*QUIT": env.stop = true + + case "*HOST": + if len(params) == 0 { + env.raiseError(1, "Command missing for *HOST") + } else { + cmd := exec.Command(params[0], params[1:]...) + stdout, err := cmd.Output() + if err != nil { + env.raiseError(1, err.Error()) + } + fmt.Println(string(stdout)) + } + case "*FX": // Parse *FX args if len(params) == 0 || len(params) > 3 { diff --git a/osWord.go b/osWord.go index 79e8927..def88ca 100644 --- a/osWord.go +++ b/osWord.go @@ -2,7 +2,6 @@ package main import ( "fmt" - "strings" "time" ) @@ -27,7 +26,6 @@ func execOSWORD(env *environment) { return } line := env.in.Text() - line = strings.ToUpper(line) // TODO: check max size buffer := env.peekWord(xy)