line = Jim_GetString(objPtr, NULL);
LOG_USER_N("In procedure '%s' called at file \"%s\", line %s" JIM_NL, proc, file, line);
}
+ long t;
+ if (Jim_GetLong(interp, Jim_GetVariableStr(interp, "openocd_result", JIM_ERRMSG), &t)==JIM_OK)
+ {
+ return t;
+ }
+ return ERROR_FAIL;
} else if (retcode == JIM_EXIT) {
/* ignore. */
/* exit(Jim_GetExitCode(interp)); */
chunk = reslen - i;
if (chunk > 256)
chunk = 256;
- strncpy(buff, result, chunk);
+ strncpy(buff, result+i, chunk);
buff[chunk] = 0;
LOG_USER_N("%s", buff);
}
log_add_callback(tcl_output, tclOutput);
retval=command_run_line_internal(active_cmd_ctx, cmd);
+
+ /* we need to be able to get at the retval, so we store in a variable
+ */
+ Jim_Obj *resultvar=Jim_NewIntObj(interp, retval);
+ Jim_IncrRefCount(resultvar);
+ Jim_SetGlobalVariableStr(interp, "openocd_result", resultvar);
+ Jim_DecrRefCount(interp, resultvar);
if (startLoop)
{
LOG_OUTPUT( OPENOCD_VERSION "\n" );
- /* DANGER!!! make sure that the line below does not appear in a patch, do not remove */
- /* DANGER!!! make sure that the line below does not appear in a patch, do not remove */
- /* DANGER!!! make sure that the line below does not appear in a patch, do not remove */
- /* DANGER!!! make sure that the line below does not appear in a patch, do not remove */
- /* DANGER!!! make sure that the line below does not appear in a patch, do not remove */
- LOG_OUTPUT( "$URL$\n");
- /* DANGER!!! make sure that the line above does not appear in a patch, do not remove */
- /* DANGER!!! make sure that the line above does not appear in a patch, do not remove */
- /* DANGER!!! make sure that the line above does not appear in a patch, do not remove */
- /* DANGER!!! make sure that the line above does not appear in a patch, do not remove */
- /* DANGER!!! make sure that the line above does not appear in a patch, do not remove */
-
register_command(cmd_ctx, NULL, "init", handle_init_command,
COMMAND_ANY, "initializes target and servers - nop on subsequent invocations");
command_context_t *cmd_ctx;
cmd_ctx=setup_command_handler();
+ /* DANGER!!! make sure that the line below does not appear in a patch, do not remove */
+ /* DANGER!!! make sure that the line below does not appear in a patch, do not remove */
+ /* DANGER!!! make sure that the line below does not appear in a patch, do not remove */
+ /* DANGER!!! make sure that the line below does not appear in a patch, do not remove */
+ /* DANGER!!! make sure that the line below does not appear in a patch, do not remove */
+ LOG_OUTPUT( "$URL$\n");
+ /* DANGER!!! make sure that the line above does not appear in a patch, do not remove */
+ /* DANGER!!! make sure that the line above does not appear in a patch, do not remove */
+ /* DANGER!!! make sure that the line above does not appear in a patch, do not remove */
+ /* DANGER!!! make sure that the line above does not appear in a patch, do not remove */
+ /* DANGER!!! make sure that the line above does not appear in a patch, do not remove */
+
command_context_t *cfg_cmd_ctx;
cfg_cmd_ctx = copy_command_context(cmd_ctx);
cfg_cmd_ctx->mode = COMMAND_CONFIG;