summaryrefslogtreecommitdiffstats
path: root/tools/hcitool.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-11-26 09:17:15 +0000
committerMarcel Holtmann <marcel@holtmann.org>2006-11-26 09:17:15 +0000
commit59a4bc3afb004d7aeef69461987307738a9fe4af (patch)
tree5bc3711b14cddf2fb540cd857b010d694d25dc64 /tools/hcitool.c
parent6834de18b98fea0e7d370a296318115a659047af (diff)
Use multibyte friendly checks instead of isprint()
Diffstat (limited to 'tools/hcitool.c')
-rw-r--r--tools/hcitool.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/tools/hcitool.c b/tools/hcitool.c
index dfa3e48e..9449e7c6 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -546,9 +546,11 @@ 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] = '.';
+ for (n = 0; n < 248 && name[n]; n++) {
+ if ((unsigned char) name[i] < 32 || name[i] == 127)
+ name[i] = '.';
+ }
+
name[248] = '\0';
printf("\t%s\t%s\n", addr, name);
@@ -605,9 +607,11 @@ static void cmd_scan(int dev_id, int argc, char **argv)
if (!nc)
strcpy(name, "n/a");
} else {
- for (n = 0; n < 248 && name[n]; n++)
- if (!isprint(name[n]))
- name[n] = '.';
+ for (n = 0; n < 248 && name[n]; n++) {
+ if ((unsigned char) name[i] < 32 || name[i] == 127)
+ name[i] = '.';
+ }
+
name[248] = '\0';
nc = 0;
}