From 1ac48e7500b88a82cd7e455c74dae4028bb03e11 Mon Sep 17 00:00:00 2001 From: oharboe Date: Thu, 24 Jul 2008 20:46:15 +0000 Subject: [PATCH] OpenOCD commands w/prefix ocd_ now set the primary Tcl return value instead of messing with ocd_output local variable. Much more straightforward and expected behaviour. The side effect is that the ocd_xxx commands will print output twice(once immediately and once upon completion of command). This is a strange, expected and intentional behaviour. git-svn-id: svn://svn.berlios.de/openocd/trunk@871 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/helper/command.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helper/command.c b/src/helper/command.c index 5ac57a1e2..d31bb6ecf 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -115,7 +115,7 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv) log_remove_callback(tcl_output, tclOutput); /* We dump output into this local variable */ - Jim_SetVariableStr(interp, "ocd_output", tclOutput); + Jim_SetResult(interp, tclOutput); Jim_DecrRefCount(interp, tclOutput); for (i = 0; i < nwords; i++) @@ -205,7 +205,7 @@ command_t* register_command(command_context_t *context, command_t *parent, char free((void *)full_name); /* we now need to add an overrideable proc */ - const char *override_name=alloc_printf("proc %s%s%s {args} {return [eval \"ocd_%s%s%s $args\"]}", t1, t2, t3, t1, t2, t3); + const char *override_name=alloc_printf("proc %s%s%s {args} {eval \"ocd_%s%s%s $args\";return \"\"}", t1, t2, t3, t1, t2, t3); Jim_Eval(interp, override_name); free((void *)override_name);