diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2006-11-26 09:17:15 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2006-11-26 09:17:15 +0000 |
commit | 59a4bc3afb004d7aeef69461987307738a9fe4af (patch) | |
tree | 5bc3711b14cddf2fb540cd857b010d694d25dc64 /tools/hciconfig.c | |
parent | 6834de18b98fea0e7d370a296318115a659047af (diff) |
Use multibyte friendly checks instead of isprint()
Diffstat (limited to 'tools/hciconfig.c')
-rw-r--r-- | tools/hciconfig.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/hciconfig.c b/tools/hciconfig.c index 3e7a5fbc..18601d77 100644 --- a/tools/hciconfig.c +++ b/tools/hciconfig.c @@ -473,9 +473,11 @@ static void cmd_name(int ctl, int hdev, char *opt) exit(1); } - for (i = 0; i < 248 && name[i]; i++) - if (!isprint(name[i])) + for (i = 0; i < 248 && name[i]; i++) { + if ((unsigned char) name[i] < 32 || name[i] == 127) name[i] = '.'; + } + name[248] = '\0'; print_dev_hdr(&di); @@ -1002,9 +1004,11 @@ static void cmd_inq_data(int ctl, int hdev, char *opt) str = malloc(len); if (str) { snprintf(str, len, "%s", ptr); - for (i = 0; i < len - 1; i++) - if (!isprint(str[i])) + for (i = 0; i < len - 1; i++) { + if ((unsigned char) str[i] < 32 || str[i] == 127) str[i] = '.'; + } + printf("\t%s local name: \'%s\'\n", type == 0x08 ? "Shortened" : "Complete", str); free(str); |