From 2861877b32a7a2f4022a1c3d9b66c9b4879878ac Mon Sep 17 00:00:00 2001 From: Zachary T Welch Date: Sun, 15 Nov 2009 05:57:37 -0800 Subject: command_handler: change 'cmd_ctx' to CMD_CTX Convert all command handler 'cmd_ctx' parameter usage with CMD_CTX. --- src/helper/command.h | 2 +- src/helper/ioutil.c | 26 +++++++++++++------------- src/helper/log.c | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src/helper') diff --git a/src/helper/command.h b/src/helper/command.h index 3e366275..74849646 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -244,7 +244,7 @@ DECLARE_PARSE_WRAPPER(_s8, int8_t); do { \ int retval = parse_##type(in, &(out)); \ if (ERROR_OK != retval) { \ - command_print(cmd_ctx, stringify(out) \ + command_print(CMD_CTX, stringify(out) \ " option value ('%s') is not valid", in); \ return retval; \ } \ diff --git a/src/helper/ioutil.c b/src/helper/ioutil.c index 3fc1a966..3fb3014a 100644 --- a/src/helper/ioutil.c +++ b/src/helper/ioutil.c @@ -61,13 +61,13 @@ COMMAND_HANDLER(handle_rm_command) { if (CMD_ARGC != 1) { - command_print(cmd_ctx, "rm "); + command_print(CMD_CTX, "rm "); return ERROR_INVALID_ARGUMENTS; } if (unlink(CMD_ARGV[0]) != 0) { - command_print(cmd_ctx, "failed: %d", errno); + command_print(CMD_CTX, "failed: %d", errno); } return ERROR_OK; @@ -137,7 +137,7 @@ COMMAND_HANDLER(handle_cat_command) { if (CMD_ARGC != 1) { - command_print(cmd_ctx, "cat "); + command_print(CMD_CTX, "cat "); return ERROR_INVALID_ARGUMENTS; } @@ -148,12 +148,12 @@ COMMAND_HANDLER(handle_cat_command) int retval = loadFile(CMD_ARGV[0], &data, &len); if (retval == ERROR_OK) { - command_print(cmd_ctx, "%s", (char *)data); + command_print(CMD_CTX, "%s", (char *)data); free(data); } else { - command_print(cmd_ctx, "%s not found %d", CMD_ARGV[0], retval); + command_print(CMD_CTX, "%s not found %d", CMD_ARGV[0], retval); } return ERROR_OK; @@ -163,7 +163,7 @@ COMMAND_HANDLER(handle_trunc_command) { if (CMD_ARGC != 1) { - command_print(cmd_ctx, "trunc "); + command_print(CMD_CTX, "trunc "); return ERROR_INVALID_ARGUMENTS; } @@ -182,7 +182,7 @@ COMMAND_HANDLER(handle_meminfo_command) if (CMD_ARGC != 0) { - command_print(cmd_ctx, "meminfo"); + command_print(CMD_CTX, "meminfo"); return ERROR_INVALID_ARGUMENTS; } @@ -190,11 +190,11 @@ COMMAND_HANDLER(handle_meminfo_command) if (prev > 0) { - command_print(cmd_ctx, "Diff: %d", prev - info.fordblks); + command_print(CMD_CTX, "Diff: %d", prev - info.fordblks); } prev = info.fordblks; - command_print(cmd_ctx, "Available ram: %d", info.fordblks); + command_print(CMD_CTX, "Available ram: %d", info.fordblks); return ERROR_OK; } @@ -204,7 +204,7 @@ COMMAND_HANDLER(handle_append_command) { if (CMD_ARGC < 1) { - command_print(cmd_ctx, + command_print(CMD_CTX, "append [, [, ...]]"); return ERROR_INVALID_ARGUMENTS; } @@ -276,7 +276,7 @@ COMMAND_HANDLER(handle_cp_command) break; } - command_print(cmd_ctx, "%zu", len - pos); + command_print(CMD_CTX, "%zu", len - pos); pos += chunk; @@ -286,10 +286,10 @@ COMMAND_HANDLER(handle_cp_command) if (retval == ERROR_OK) { - command_print(cmd_ctx, "Copied %s to %s", CMD_ARGV[0], CMD_ARGV[1]); + command_print(CMD_CTX, "Copied %s to %s", CMD_ARGV[0], CMD_ARGV[1]); } else { - command_print(cmd_ctx, "Failed: %d", retval); + command_print(CMD_CTX, "Failed: %d", retval); } if (data != NULL) diff --git a/src/helper/log.c b/src/helper/log.c index 0e04c8e1..caaed423 100644 --- a/src/helper/log.c +++ b/src/helper/log.c @@ -296,7 +296,7 @@ COMMAND_HANDLER(handle_debug_level_command) } } - command_print(cmd_ctx, "debug_level: %i", debug_level); + command_print(CMD_CTX, "debug_level: %i", debug_level); return ERROR_OK; } -- cgit v1.2.3