diff options
author | Zachary T Welch <zw@superlucidity.net> | 2009-11-15 08:15:59 -0800 |
---|---|---|
committer | Zachary T Welch <zw@superlucidity.net> | 2009-11-17 11:38:07 -0800 |
commit | 23402315ce01071f30d7ec0c5ca7563ce41f1cc6 (patch) | |
tree | 2b1cad0044d857844f7d6b35b5ffadd390594c9b /src/helper | |
parent | 7bf1a86e473a12882bf6f71cb4d0d416394b69d4 (diff) | |
download | riscv-openocd-23402315ce01071f30d7ec0c5ca7563ce41f1cc6.zip riscv-openocd-23402315ce01071f30d7ec0c5ca7563ce41f1cc6.tar.gz riscv-openocd-23402315ce01071f30d7ec0c5ca7563ce41f1cc6.tar.bz2 |
command_handler: change 'args' to CMD_ARGV
This patch converts all instances of 'args' in COMMAND_HANDLER routines
to use CMD_ARGV macro.
Diffstat (limited to 'src/helper')
-rw-r--r-- | src/helper/command.c | 8 | ||||
-rw-r--r-- | src/helper/ioutil.c | 20 | ||||
-rw-r--r-- | src/helper/log.c | 4 |
3 files changed, 16 insertions, 16 deletions
diff --git a/src/helper/command.c b/src/helper/command.c index 3abfdd6..fdb59f0 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -142,7 +142,7 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv) log_add_callback(tcl_output, tclOutput); - // turn words[0] into args[-1] with this cast + // turn words[0] into CMD_ARGV[-1] with this cast retval = run_command(context, c, (const char **)words + 1, nwords); log_remove_callback(tcl_output, tclOutput); @@ -725,7 +725,7 @@ COMMAND_HANDLER(handle_sleep_command) bool busy = false; if (CMD_ARGC == 2) { - if (strcmp(args[1], "busy") == 0) + if (strcmp(CMD_ARGV[1], "busy") == 0) busy = true; else return ERROR_COMMAND_SYNTAX_ERROR; @@ -734,7 +734,7 @@ COMMAND_HANDLER(handle_sleep_command) return ERROR_COMMAND_SYNTAX_ERROR; unsigned long duration = 0; - int retval = parse_ulong(args[0], &duration); + int retval = parse_ulong(CMD_ARGV[0], &duration); if (ERROR_OK != retval) return retval; @@ -758,7 +758,7 @@ COMMAND_HANDLER(handle_fast_command) if (CMD_ARGC != 1) return ERROR_COMMAND_SYNTAX_ERROR; - fast_and_dangerous = strcmp("enable", args[0]) == 0; + fast_and_dangerous = strcmp("enable", CMD_ARGV[0]) == 0; return ERROR_OK; } diff --git a/src/helper/ioutil.c b/src/helper/ioutil.c index 2e8229c..3fc1a96 100644 --- a/src/helper/ioutil.c +++ b/src/helper/ioutil.c @@ -65,7 +65,7 @@ COMMAND_HANDLER(handle_rm_command) return ERROR_INVALID_ARGUMENTS; } - if (unlink(args[0]) != 0) + if (unlink(CMD_ARGV[0]) != 0) { command_print(cmd_ctx, "failed: %d", errno); } @@ -145,7 +145,7 @@ COMMAND_HANDLER(handle_cat_command) void *data; size_t len; - int retval = loadFile(args[0], &data, &len); + int retval = loadFile(CMD_ARGV[0], &data, &len); if (retval == ERROR_OK) { command_print(cmd_ctx, "%s", (char *)data); @@ -153,7 +153,7 @@ COMMAND_HANDLER(handle_cat_command) } else { - command_print(cmd_ctx, "%s not found %d", args[0], retval); + command_print(cmd_ctx, "%s not found %d", CMD_ARGV[0], retval); } return ERROR_OK; @@ -168,7 +168,7 @@ COMMAND_HANDLER(handle_trunc_command) } FILE *config_file = NULL; - config_file = fopen(args[0], "w"); + config_file = fopen(CMD_ARGV[0], "w"); if (config_file != NULL) fclose(config_file); @@ -211,7 +211,7 @@ COMMAND_HANDLER(handle_append_command) int retval = ERROR_FAIL; FILE *config_file = NULL; - config_file = fopen(args[0], "a"); + config_file = fopen(CMD_ARGV[0], "a"); if (config_file != NULL) { fseek(config_file, 0, SEEK_END); @@ -219,7 +219,7 @@ COMMAND_HANDLER(handle_append_command) unsigned i; for (i = 1; i < CMD_ARGC; i++) { - if (fwrite(args[i], 1, strlen(args[i]), config_file) != strlen(args[i])) + if (fwrite(CMD_ARGV[i], 1, strlen(CMD_ARGV[i]), config_file) != strlen(CMD_ARGV[i])) break; if (i != CMD_ARGC - 1) { @@ -250,11 +250,11 @@ COMMAND_HANDLER(handle_cp_command) void *data; size_t len; - int retval = loadFile(args[0], &data, &len); + int retval = loadFile(CMD_ARGV[0], &data, &len); if (retval != ERROR_OK) return retval; - FILE *f = fopen(args[1], "wb"); + FILE *f = fopen(CMD_ARGV[1], "wb"); if (f == NULL) retval = ERROR_INVALID_ARGUMENTS; @@ -286,7 +286,7 @@ COMMAND_HANDLER(handle_cp_command) if (retval == ERROR_OK) { - command_print(cmd_ctx, "Copied %s to %s", args[0], args[1]); + command_print(cmd_ctx, "Copied %s to %s", CMD_ARGV[0], CMD_ARGV[1]); } else { command_print(cmd_ctx, "Failed: %d", retval); @@ -298,7 +298,7 @@ COMMAND_HANDLER(handle_cp_command) fclose(f); if (retval != ERROR_OK) - unlink(args[1]); + unlink(CMD_ARGV[1]); return retval; } diff --git a/src/helper/log.c b/src/helper/log.c index 715f2fa..0e04c8e 100644 --- a/src/helper/log.c +++ b/src/helper/log.c @@ -278,7 +278,7 @@ COMMAND_HANDLER(handle_debug_level_command) if (CMD_ARGC == 1) { unsigned new_level; - COMMAND_PARSE_NUMBER(uint, args[0], new_level); + COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], new_level); debug_level = MIN(new_level, LOG_LVL_DEBUG); } else if (CMD_ARGC > 1) @@ -305,7 +305,7 @@ COMMAND_HANDLER(handle_log_output_command) { if (CMD_ARGC == 1) { - FILE* file = fopen(args[0], "w"); + FILE* file = fopen(CMD_ARGV[0], "w"); if (file) { |