summaryrefslogtreecommitdiff
path: root/src/helper
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-15 04:57:12 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-17 11:38:06 -0800
commit7bf1a86e473a12882bf6f71cb4d0d416394b69d4 (patch)
tree2c9c1d2138df704ac551cdafe105dbb68b8f23b8 /src/helper
parent5b9899d6ea1e0cf763465c64c700f20eddd893f9 (diff)
downloadopenocd_libswd-7bf1a86e473a12882bf6f71cb4d0d416394b69d4.tar.gz
openocd_libswd-7bf1a86e473a12882bf6f71cb4d0d416394b69d4.tar.bz2
openocd_libswd-7bf1a86e473a12882bf6f71cb4d0d416394b69d4.tar.xz
openocd_libswd-7bf1a86e473a12882bf6f71cb4d0d416394b69d4.zip
command_handler: change to 'argc' to CMD_ARGC
This patch converts all instances of 'argc' in COMMAND_HANDLER routines to use CMD_ARGC.
Diffstat (limited to 'src/helper')
-rw-r--r--src/helper/command.c6
-rw-r--r--src/helper/ioutil.c18
-rw-r--r--src/helper/log.c6
3 files changed, 15 insertions, 15 deletions
diff --git a/src/helper/command.c b/src/helper/command.c
index 7edd585f..3abfdd67 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -723,14 +723,14 @@ static int jim_capture(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
COMMAND_HANDLER(handle_sleep_command)
{
bool busy = false;
- if (argc == 2)
+ if (CMD_ARGC == 2)
{
if (strcmp(args[1], "busy") == 0)
busy = true;
else
return ERROR_COMMAND_SYNTAX_ERROR;
}
- else if (argc < 1 || argc > 2)
+ else if (CMD_ARGC < 1 || CMD_ARGC > 2)
return ERROR_COMMAND_SYNTAX_ERROR;
unsigned long duration = 0;
@@ -755,7 +755,7 @@ COMMAND_HANDLER(handle_sleep_command)
COMMAND_HANDLER(handle_fast_command)
{
- if (argc != 1)
+ if (CMD_ARGC != 1)
return ERROR_COMMAND_SYNTAX_ERROR;
fast_and_dangerous = strcmp("enable", args[0]) == 0;
diff --git a/src/helper/ioutil.c b/src/helper/ioutil.c
index a9474a63..2e8229c5 100644
--- a/src/helper/ioutil.c
+++ b/src/helper/ioutil.c
@@ -59,7 +59,7 @@
COMMAND_HANDLER(handle_rm_command)
{
- if (argc != 1)
+ if (CMD_ARGC != 1)
{
command_print(cmd_ctx, "rm <filename>");
return ERROR_INVALID_ARGUMENTS;
@@ -135,7 +135,7 @@ int loadFile(const char *fileName, void **data, size_t *len)
COMMAND_HANDLER(handle_cat_command)
{
- if (argc != 1)
+ if (CMD_ARGC != 1)
{
command_print(cmd_ctx, "cat <filename>");
return ERROR_INVALID_ARGUMENTS;
@@ -161,7 +161,7 @@ COMMAND_HANDLER(handle_cat_command)
COMMAND_HANDLER(handle_trunc_command)
{
- if (argc != 1)
+ if (CMD_ARGC != 1)
{
command_print(cmd_ctx, "trunc <filename>");
return ERROR_INVALID_ARGUMENTS;
@@ -180,7 +180,7 @@ COMMAND_HANDLER(handle_meminfo_command)
static int prev = 0;
struct mallinfo info;
- if (argc != 0)
+ if (CMD_ARGC != 0)
{
command_print(cmd_ctx, "meminfo");
return ERROR_INVALID_ARGUMENTS;
@@ -202,7 +202,7 @@ COMMAND_HANDLER(handle_meminfo_command)
COMMAND_HANDLER(handle_append_command)
{
- if (argc < 1)
+ if (CMD_ARGC < 1)
{
command_print(cmd_ctx,
"append <filename> [<string1>, [<string2>, ...]]");
@@ -217,17 +217,17 @@ COMMAND_HANDLER(handle_append_command)
fseek(config_file, 0, SEEK_END);
unsigned i;
- for (i = 1; i < argc; i++)
+ for (i = 1; i < CMD_ARGC; i++)
{
if (fwrite(args[i], 1, strlen(args[i]), config_file) != strlen(args[i]))
break;
- if (i != argc - 1)
+ if (i != CMD_ARGC - 1)
{
if (fwrite(" ", 1, 1, config_file) != 1)
break;
}
}
- if ((i == argc) && (fwrite("\n", 1, 1, config_file) == 1))
+ if ((i == CMD_ARGC) && (fwrite("\n", 1, 1, config_file) == 1))
{
retval = ERROR_OK;
}
@@ -241,7 +241,7 @@ COMMAND_HANDLER(handle_append_command)
COMMAND_HANDLER(handle_cp_command)
{
- if (argc != 2)
+ if (CMD_ARGC != 2)
{
return ERROR_INVALID_ARGUMENTS;
}
diff --git a/src/helper/log.c b/src/helper/log.c
index 9396ffe9..715f2fa6 100644
--- a/src/helper/log.c
+++ b/src/helper/log.c
@@ -275,13 +275,13 @@ void log_printf_lf(enum log_levels level, const char *file, unsigned line, const
*/
COMMAND_HANDLER(handle_debug_level_command)
{
- if (argc == 1)
+ if (CMD_ARGC == 1)
{
unsigned new_level;
COMMAND_PARSE_NUMBER(uint, args[0], new_level);
debug_level = MIN(new_level, LOG_LVL_DEBUG);
}
- else if (argc > 1)
+ else if (CMD_ARGC > 1)
return ERROR_COMMAND_SYNTAX_ERROR;
if (debug_level >= LOG_LVL_DEBUG && server_use_pipes == 1)
@@ -303,7 +303,7 @@ COMMAND_HANDLER(handle_debug_level_command)
COMMAND_HANDLER(handle_log_output_command)
{
- if (argc == 1)
+ if (CMD_ARGC == 1)
{
FILE* file = fopen(args[0], "w");