diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | athsta.c | 43 |
2 files changed, 2 insertions, 43 deletions
@@ -1,6 +1,6 @@ athsta: athsta.c - gcc -g -o athsta athsta.c + gcc -Wall -g -o athsta athsta.c clean: rm -f *.o @@ -97,48 +97,6 @@ printie(const char* tag, const uint8_t *ie, size_t ielen, int maxlen) } } -/* - * Copy the ssid string contents into buf, truncating to fit. If the - * ssid is entirely printable then just copy intact. Otherwise convert - * to hexadecimal. If the result is truncated then replace the last - * three characters with "...". - */ -static int -copy_essid(char buf[], size_t bufsize, const u_int8_t *essid, size_t essid_len) -{ - const u_int8_t *p; - size_t maxlen; - int i; - - if (essid_len > bufsize) - maxlen = bufsize; - else - maxlen = essid_len; - /* determine printable or not */ - for (i = 0, p = essid; i < maxlen; i++, p++) { - if (*p < ' ' || *p > 0x7e) - break; - } - if (i != maxlen) { /* not printable, print as hex */ - if (bufsize < 3) - return 0; - strlcpy(buf, "0x", bufsize); - bufsize -= 2; - p = essid; - for (i = 0; i < maxlen && bufsize >= 2; i++) { - sprintf(&buf[2+2*i], "%02x", p[i]); - bufsize -= 2; - } - if (i != essid_len) - memcpy(&buf[2+2*i-3], "...", 3); - } else { /* printable, truncate as needed */ - memcpy(buf, essid, maxlen); - if (maxlen != essid_len) - memcpy(&buf[maxlen-3], "...", 3); - } - return maxlen; -} - /* unaligned little endian access */ #define LE_READ_4(p) \ ((u_int32_t) \ @@ -326,3 +284,4 @@ main (int argc, char* argv[]) return 0; } + |