summaryrefslogtreecommitdiff
path: root/tools/hcitool.c
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2015-01-12 17:19:39 +0100
committerJohan Hedberg <johan.hedberg@intel.com>2015-01-14 13:05:40 +0200
commit621f4c0873a5e07aeb7216ced836295302f65e32 (patch)
treef61af2d1d1f90fdebe7f69e4a23c58912d41b4c4 /tools/hcitool.c
parent91865a99749fbb2fbf84b645bc0cda09e22cf046 (diff)
downloadbluez-621f4c0873a5e07aeb7216ced836295302f65e32.tar.gz
tools/hcitool: Simplify parsing in cmd_lecup
strtoul already detects 10 or 16 base if given base is 0.
Diffstat (limited to 'tools/hcitool.c')
-rw-r--r--tools/hcitool.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/tools/hcitool.c b/tools/hcitool.c
index 612e5bcf8..a37e02873 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -3307,7 +3307,7 @@ static const char *lecup_help =
static void cmd_lecup(int dev_id, int argc, char **argv)
{
uint16_t handle = 0, min, max, latency, timeout;
- int opt, dd, base;
+ int opt, dd;
int options = 0;
/* Aleatory valid values */
@@ -3317,26 +3317,21 @@ static void cmd_lecup(int dev_id, int argc, char **argv)
timeout = 0x0C80;
for_each_opt(opt, lecup_options, NULL) {
- if (optarg && strncasecmp("0x", optarg, 2) == 0)
- base = 16;
- else
- base = 10;
-
switch (opt) {
case 'H':
- handle = strtoul(optarg, NULL, base);
+ handle = strtoul(optarg, NULL, 0);
break;
case 'm':
- min = strtoul(optarg, NULL, base);
+ min = strtoul(optarg, NULL, 0);
break;
case 'M':
- max = strtoul(optarg, NULL, base);
+ max = strtoul(optarg, NULL, 0);
break;
case 'l':
- latency = strtoul(optarg, NULL, base);
+ latency = strtoul(optarg, NULL, 0);
break;
case 't':
- timeout = strtoul(optarg, NULL, base);
+ timeout = strtoul(optarg, NULL, 0);
break;
default:
printf("%s", lecup_help);