summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-08 10:54:52 +0000
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-08 10:54:52 +0000
commitd7c4e1ec9370d6c053ad93967793383683175ed2 (patch)
treece9099e392e18ef8a9f9a197685a4480fdeeb0d6 /src
parent47a1185d5d97483698610d9e7bf03a5411cac5d2 (diff)
downloadopenocd_libswd-d7c4e1ec9370d6c053ad93967793383683175ed2.tar.gz
openocd_libswd-d7c4e1ec9370d6c053ad93967793383683175ed2.tar.bz2
openocd_libswd-d7c4e1ec9370d6c053ad93967793383683175ed2.tar.xz
openocd_libswd-d7c4e1ec9370d6c053ad93967793383683175ed2.zip
Update JTAG reset delay command handlers:
- Fixes for error handling: - Return a syntax error instead of calling exit(-1). - Return error when more than one argument is provided too. - Remove useless braces and indent after the if/return statements. - Wrap function arguments to fit in 80 columns. git-svn-id: svn://svn.berlios.de/openocd/trunk@2111 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src')
-rw-r--r--src/jtag/jtag.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/jtag/jtag.c b/src/jtag/jtag.c
index 113c9610..ec5578b7 100644
--- a/src/jtag/jtag.c
+++ b/src/jtag/jtag.c
@@ -2112,33 +2112,27 @@ next:
return ERROR_OK;
}
-static int handle_jtag_nsrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int handle_jtag_nsrst_delay_command(struct command_context_s *cmd_ctx,
+ char *cmd, char **args, int argc)
{
- if (argc < 1)
+ if (argc != 1)
{
- LOG_ERROR("jtag_nsrst_delay <ms> command takes one required argument");
- exit(-1);
- }
- else
- {
- jtag_set_nsrst_delay(strtoul(args[0], NULL, 0));
+ LOG_ERROR("jtag_nsrst_delay <ms> -- command requires one argument");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
-
+ jtag_set_nsrst_delay(strtoul(args[0], NULL, 0));
return ERROR_OK;
}
-static int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx,
+ char *cmd, char **args, int argc)
{
- if (argc < 1)
+ if (argc != 1)
{
- LOG_ERROR("jtag_ntrst_delay <ms> command takes one required argument");
- exit(-1);
- }
- else
- {
- jtag_set_ntrst_delay(strtoul(args[0], NULL, 0));
+ LOG_ERROR("jtag_ntrst_delay <ms> -- command requires one argument");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
-
+ jtag_set_ntrst_delay(strtoul(args[0], NULL, 0));
return ERROR_OK;
}