summaryrefslogtreecommitdiff
path: root/tools/hciconfig.c
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2010-12-20 11:13:48 +0100
committerJohan Hedberg <johan.hedberg@nokia.com>2010-12-20 17:39:06 +0200
commit57aa201c25cedd96fdf8446f459494051d66103b (patch)
tree3b556f09b06f371d68cd2b1bfdb4b7d37d5b4279 /tools/hciconfig.c
parentcb53bff26baada1e7e5b814e1e6093f6d2e1bd94 (diff)
downloadbluez-57aa201c25cedd96fdf8446f459494051d66103b.tar.gz
Fix tools UI to avoid program launch mistakes.
hciconfig: warrning user on unknown commands hcitool: return error on unknown command in hcitool fix length size in comparision to avoid ambiguity commands check if command number of arguments is correct
Diffstat (limited to 'tools/hciconfig.c')
-rw-r--r--tools/hciconfig.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/hciconfig.c b/tools/hciconfig.c
index 3627b7ca8..995aca109 100644
--- a/tools/hciconfig.c
+++ b/tools/hciconfig.c
@@ -1778,7 +1778,7 @@ static void usage(void)
printf("hciconfig - HCI device configuration utility\n");
printf("Usage:\n"
"\thciconfig\n"
- "\thciconfig [-a] hciX [command]\n");
+ "\thciconfig [-a] hciX [command ...]\n");
printf("Commands:\n");
for (i=0; command[i].cmd; i++)
printf("\t%-10s %-8s\t%s\n", command[i].cmd,
@@ -1841,7 +1841,8 @@ int main(int argc, char *argv[])
while (argc > 0) {
for (i = 0; command[i].cmd; i++) {
- if (strncmp(command[i].cmd, *argv, 5))
+ if (strncmp(command[i].cmd,
+ *argv, strlen(command[i].cmd)))
continue;
if (command[i].opt) {
@@ -1852,6 +1853,11 @@ int main(int argc, char *argv[])
cmd = 1;
break;
}
+
+ if (command[i].cmd == 0)
+ fprintf(stderr, "Warning: unknown command - \"%s\"\n",
+ *argv);
+
argc--; argv++;
}