diff options
author | zwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-06-11 11:42:40 +0000 |
---|---|---|
committer | zwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-06-11 11:42:40 +0000 |
commit | d7ada2457e35d92edfe6bc9946f9c91bd6aeac9b (patch) | |
tree | 39cb7ebbe09162368c6cb00b1c8384f201b0feab | |
parent | e4850d7159d557519fd012bda3bc6e9f35763689 (diff) | |
download | openocd_libswd-d7ada2457e35d92edfe6bc9946f9c91bd6aeac9b.tar.gz openocd_libswd-d7ada2457e35d92edfe6bc9946f9c91bd6aeac9b.tar.bz2 openocd_libswd-d7ada2457e35d92edfe6bc9946f9c91bd6aeac9b.tar.xz openocd_libswd-d7ada2457e35d92edfe6bc9946f9c91bd6aeac9b.zip |
Simplify and fix handle_reset_command:
- Return syntax error if more than one argument is given.
- Move variables to location of first use.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2192 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r-- | src/target/target.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/target/target.c b/src/target/target.c index 260f9cec..b207ac95 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -1912,11 +1912,13 @@ static int handle_soft_reset_halt_command(struct command_context_s *cmd_ctx, cha static int handle_reset_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { - const Jim_Nvp *n; - enum target_reset_mode reset_mode = RESET_RUN; + if (argc > 1) + return ERROR_COMMAND_SYNTAX_ERROR; - if (argc >= 1) + enum target_reset_mode reset_mode = RESET_RUN; + if (argc == 1) { + const Jim_Nvp *n; n = Jim_Nvp_name2value_simple( nvp_reset_modes, args[0] ); if( (n->name == NULL) || (n->value == RESET_UNKNOWN) ){ return ERROR_COMMAND_SYNTAX_ERROR; |