summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-06-17 12:10:54 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-06-17 12:10:54 +0000
commit1d2e71b109d907473939864caa5afec86000d58a (patch)
treea96b3aa56635732e0ed8fac4dcb09edca0fb76d6 /tools
parent3257d9b3a8f59561960c75f310fea33d23858024 (diff)
Replace non-printable characters in device names
Diffstat (limited to 'tools')
-rw-r--r--tools/hcitool.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/hcitool.c b/tools/hcitool.c
index 210ab2ba..e6561feb 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -34,6 +34,7 @@
#include <stdio.h>
#include <errno.h>
+#include <ctype.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
@@ -411,7 +412,7 @@ static void cmd_scan(int dev_id, int argc, char **argv)
struct hci_dev_info di;
struct hci_conn_info_req *cr;
int extcls = 0, extinf = 0, extoui = 0;
- int i, opt, dd, cc, nc;
+ int i, n, opt, dd, cc, nc;
length = 8; /* ~10 seconds */
num_rsp = 0;
@@ -510,6 +511,10 @@ static void cmd_scan(int dev_id, int argc, char **argv)
sizeof(name), name, 100000) < 0)
strcpy(name, "n/a");
+ for (n = 0; n < 248 && name[n]; n++)
+ if (!isprint(name[n]))
+ name[n] = '.';
+
printf("\t%s\t%s\n", addr, name);
continue;
}
@@ -563,8 +568,12 @@ static void cmd_scan(int dev_id, int argc, char **argv)
sizeof(name), name, 100000) < 0) {
if (!nc)
strcpy(name, "n/a");
- } else
+ } else {
+ for (n = 0; n < 248 && name[n]; n++)
+ if (!isprint(name[n]))
+ name[n] = '.';
nc = 0;
+ }
}
printf("Device name:\t%s%s\n", name, nc ? " [cached]" : "");