summaryrefslogtreecommitdiff
path: root/src/jtag
diff options
context:
space:
mode:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-12 01:40:03 +0000
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-12 01:40:03 +0000
commitae28b96ab9824474a8f5a808480fee3fe7db1f3a (patch)
treeb786924869514cf0a09e04c09d148e9da77d21bf /src/jtag
parent0f6a47837e64836385268bb4e99e123477775e68 (diff)
downloadopenocd+libswd-ae28b96ab9824474a8f5a808480fee3fe7db1f3a.tar.gz
openocd+libswd-ae28b96ab9824474a8f5a808480fee3fe7db1f3a.tar.bz2
openocd+libswd-ae28b96ab9824474a8f5a808480fee3fe7db1f3a.tar.xz
openocd+libswd-ae28b96ab9824474a8f5a808480fee3fe7db1f3a.zip
Simplify and improve parport_handle_parport_port_command:
- Show the port number to the user when asking for it or setting it. - Print an error if the parport_port has already been set. - Use parse_u16 helper to ensure the parport_port string parses correctly. git-svn-id: svn://svn.berlios.de/openocd/trunk@2209 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/jtag')
-rw-r--r--src/jtag/parport.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/jtag/parport.c b/src/jtag/parport.c
index 4ee2202d..129caf0b 100644
--- a/src/jtag/parport.c
+++ b/src/jtag/parport.c
@@ -429,12 +429,23 @@ static int parport_quit(void)
static int parport_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
- if (argc == 0)
- return ERROR_OK;
+ if (argc == 1)
+ {
+ /* only if the port wasn't overwritten by cmdline */
+ if (parport_port == 0)
+ {
+ int retval = parse_u16(args[0], &parport_port);
+ if (ERROR_OK != retval)
+ return retval;
+ }
+ else
+ {
+ LOG_ERROR("The parport port was already configured!");
+ return ERROR_FAIL;
+ }
+ }
- /* only if the port wasn't overwritten by cmdline */
- if (parport_port == 0)
- parport_port = strtoul(args[0], NULL, 0);
+ command_print(cmd_ctx, "parport port = %u", parport_port);
return ERROR_OK;
}