diff options
author | Jon Povey <jon.povey@racelogic.co.uk> | 2011-01-02 23:52:47 +0900 |
---|---|---|
committer | Øyvind Harboe <oyvind.harboe@zylin.com> | 2011-01-02 20:01:20 +0100 |
commit | 18a5a46bd94f6e224151ba62c0b9094a96b7387a (patch) | |
tree | 98b77b2514c51d617d558fea94182a28e18544c8 /src/svf | |
parent | 093ec6656ab7fb523b8a811f4bd628e3b50f8367 (diff) | |
download | openocd_libswd-18a5a46bd94f6e224151ba62c0b9094a96b7387a.tar.gz openocd_libswd-18a5a46bd94f6e224151ba62c0b9094a96b7387a.tar.bz2 openocd_libswd-18a5a46bd94f6e224151ba62c0b9094a96b7387a.tar.xz openocd_libswd-18a5a46bd94f6e224151ba62c0b9094a96b7387a.zip |
svf: fix USAGE and related error reporting
Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
Diffstat (limited to 'src/svf')
-rw-r--r-- | src/svf/svf.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/svf/svf.c b/src/svf/svf.c index a015e3c4..a6f2f6f3 100644 --- a/src/svf/svf.c +++ b/src/svf/svf.c @@ -315,8 +315,6 @@ COMMAND_HANDLER(handle_svf_command) { #define SVF_MIN_NUM_OF_OPTIONS 1 #define SVF_MAX_NUM_OF_OPTIONS 5 -#define USAGE [-tap device.tap] <file> [quiet] [progress] -#define PRINT_USAGE command_print(CMD_CTX, "svf USAGE") int command_num = 0; int ret = ERROR_OK; long long time_measure_ms; @@ -330,8 +328,7 @@ COMMAND_HANDLER(handle_svf_command) if ((CMD_ARGC < SVF_MIN_NUM_OF_OPTIONS) || (CMD_ARGC > SVF_MAX_NUM_OF_OPTIONS)) { - PRINT_USAGE; - return ERROR_FAIL; + return ERROR_COMMAND_SYNTAX_ERROR; } // parse command line @@ -359,10 +356,9 @@ COMMAND_HANDLER(handle_svf_command) else if ((svf_fd = fopen(CMD_ARGV[i], "r")) == NULL) { int err = errno; - PRINT_USAGE; command_print(CMD_CTX, "open(\"%s\"): %s", CMD_ARGV[i], strerror(err)); // no need to free anything now - return ERROR_FAIL; + return ERROR_COMMAND_SYNTAX_ERROR; } else { @@ -372,8 +368,7 @@ COMMAND_HANDLER(handle_svf_command) if (svf_fd == NULL) { - PRINT_USAGE; - return ERROR_FAIL; + return ERROR_COMMAND_SYNTAX_ERROR; } // get time @@ -1712,7 +1707,7 @@ static const struct command_registration svf_command_handlers[] = { .handler = handle_svf_command, .mode = COMMAND_EXEC, .help = "Runs a SVF file.", - .usage = "USAGE", + .usage = "svf [-tap device.tap] <file> [quiet] [progress]", }, COMMAND_REGISTRATION_DONE }; |