diff options
author | ERAMOTO Masaya <eramoto.masaya@jp.fujitsu.com> | 2017-10-06 13:12:12 +0900 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2017-10-16 17:06:33 +0300 |
commit | 133cbc759152c0a8d20e38387207b9212b25a64b (patch) | |
tree | ea00a2f3a9b511bedfd0da9d4fca4c1dc5202737 /tools/btmgmt.c | |
parent | 2223d9f22dab516521ec7913ca8ddcdb1a73290f (diff) | |
download | bluez-133cbc759152c0a8d20e38387207b9212b25a64b.tar.gz |
tools/btmgmt: Add readline support to stop-find
So can continue to run btmgmt even if using 'stop-find --help' in the
interactive mode.
Diffstat (limited to 'tools/btmgmt.c')
-rw-r--r-- | tools/btmgmt.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/tools/btmgmt.c b/tools/btmgmt.c index e454d864d..0f21f48da 100644 --- a/tools/btmgmt.c +++ b/tools/btmgmt.c @@ -2357,13 +2357,12 @@ static void stop_find_rsp(uint8_t status, uint16_t len, const void *param, void *user_data) { if (status != 0) { - fprintf(stderr, - "Stop Discovery failed: status 0x%02x (%s)\n", + error("Stop Discovery failed: status 0x%02x (%s)", status, mgmt_errstr(status)); return noninteractive_quit(EXIT_SUCCESS); } - printf("Discovery stopped\n"); + print("Discovery stopped"); discovery = false; noninteractive_quit(EXIT_SUCCESS); @@ -2371,7 +2370,7 @@ static void stop_find_rsp(uint8_t status, uint16_t len, const void *param, static void stop_find_usage(void) { - printf("Usage: btmgmt stop-find [-l|-b]>\n"); + print("Usage: btmgmt stop-find [-l|-b]"); } static struct option stop_find_options[] = { @@ -2406,7 +2405,7 @@ static void cmd_stop_find(struct mgmt *mgmt, uint16_t index, int argc, default: stop_find_usage(); optind = 0; - exit(EXIT_SUCCESS); + return noninteractive_quit(EXIT_SUCCESS); } } @@ -2419,8 +2418,8 @@ static void cmd_stop_find(struct mgmt *mgmt, uint16_t index, int argc, if (mgmt_send(mgmt, MGMT_OP_STOP_DISCOVERY, index, sizeof(cp), &cp, stop_find_rsp, NULL, NULL) == 0) { - fprintf(stderr, "Unable to send stop_discovery cmd\n"); - exit(EXIT_FAILURE); + error("Unable to send stop_discovery cmd"); + return noninteractive_quit(EXIT_FAILURE); } } |