X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fhelper%2Finterpreter.c;h=c5c38b83bccb65fe2c2e95e3c2a918b8c7206f1f;hp=7e88263b7fa2c88b159d606b64247cd2acc7f8cf;hb=95df797b2e711286e3909a7d25e36519d5a6e335;hpb=8b4e882a1630d63bbc9840fa3f968e36b6ac3702 diff --git a/src/helper/interpreter.c b/src/helper/interpreter.c index 7e88263b7f..c5c38b83bc 100644 --- a/src/helper/interpreter.c +++ b/src/helper/interpreter.c @@ -17,7 +17,12 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "interpreter.h" +#include "configuration.h" #include "binarybuffer.h" #include @@ -88,7 +93,7 @@ var_t* get_var_by_namenum(char *namenum) } -int field_le_to_host(u8 *buffer, void *priv) +int field_le_to_host(u8 *buffer, void *priv, struct scan_field_s *dummy) { var_field_t *field = priv; field->value = buf_get_u32(buffer, 0, field->num_bits); @@ -122,7 +127,7 @@ int handle_var_command(struct command_context_s *cmd_ctx, char *cmd, char **args last_var_p = &((*last_var_p)->next); } - if ((args[0][0] >= 0) && (args[0][0] <= 9)) + if ((args[0][0] >= '0') && (args[0][0] <= '9')) { command_print(cmd_ctx, "invalid name specified (first character may not be a number)"); return ERROR_OK; @@ -217,7 +222,8 @@ int handle_script_command(struct command_context_s *cmd_ctx, char *cmd, char **a if (argc != 1) command_print(cmd_ctx, "usage: script "); - script_file = fopen(args[0], "r"); + script_file = open_file_from_path(cmd_ctx, args[0], "r"); + if (!script_file) { command_print(cmd_ctx, "couldn't open script file %s", args[0]); @@ -227,7 +233,7 @@ int handle_script_command(struct command_context_s *cmd_ctx, char *cmd, char **a echo = cmd_ctx->echo; cmd_ctx->echo = 1; - command_run_file(cmd_ctx, script_file, COMMAND_EXEC); + command_run_file(cmd_ctx, script_file, cmd_ctx->mode); cmd_ctx->echo = echo;