From: Johannes Berg Date: Sun, 16 Oct 2011 15:04:37 +0000 (+0200) Subject: SSID printing: escape space at beginning end, backslash X-Git-Tag: v3.2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3f61273315002a8f2ca7f63f9eec0b3497905e03;p=thirdparty%2Fiw.git SSID printing: escape space at beginning end, backslash To make SSID printing point out spaces at the beginning and end explicitly escape them with \x20. Also escape the backslash itself so that it's unambiguous. --- diff --git a/util.c b/util.c index afffeb6..e03ec2c 100644 --- a/util.c +++ b/util.c @@ -250,8 +250,11 @@ void print_ssid_escaped(const uint8_t len, const uint8_t *data) int i; for (i = 0; i < len; i++) { - if (isprint(data[i])) + if (isprint(data[i]) && data[i] != ' ' && data[i] != '\\') printf("%c", data[i]); + else if (data[i] == ' ' && + (i != 0 && i != len -1)) + printf(" "); else printf("\\x%.2x", data[i]); }