summaryrefslogtreecommitdiffstats
path: root/freebsd/sbin/ifconfig
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-08-22 14:59:50 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-09-21 10:29:41 +0200
commit3489e3b6396ee9944a6a2e19e675ca54c36993b4 (patch)
treecd55cfac1c96ff4b888a9606fd6a0d8eb65bb446 /freebsd/sbin/ifconfig
parentck: Define CK_MD_PPC32_LWSYNC if available (diff)
downloadrtems-libbsd-3489e3b6396ee9944a6a2e19e675ca54c36993b4.tar.bz2
Update to FreeBSD head 2018-09-17
Git mirror commit 6c2192b1ef8c50788c751f878552526800b1e319. Update #3472.
Diffstat (limited to 'freebsd/sbin/ifconfig')
-rw-r--r--freebsd/sbin/ifconfig/ifconfig.c2
-rw-r--r--freebsd/sbin/ifconfig/ifieee80211.c20
2 files changed, 14 insertions, 8 deletions
diff --git a/freebsd/sbin/ifconfig/ifconfig.c b/freebsd/sbin/ifconfig/ifconfig.c
index 56b4f6d7..03d916a1 100644
--- a/freebsd/sbin/ifconfig/ifconfig.c
+++ b/freebsd/sbin/ifconfig/ifconfig.c
@@ -127,7 +127,7 @@ static int ifconfig(int argc, char *const *argv, int iscreate,
static void status(const struct afswtch *afp, const struct sockaddr_dl *sdl,
struct ifaddrs *ifa);
static void tunnel_status(int s);
-static _Noreturn void usage(void);
+static _Noreturn void usage(void);
static struct afswtch *af_getbyname(const char *name);
static struct afswtch *af_getbyfamily(int af);
diff --git a/freebsd/sbin/ifconfig/ifieee80211.c b/freebsd/sbin/ifconfig/ifieee80211.c
index 8faeca23..fa407957 100644
--- a/freebsd/sbin/ifconfig/ifieee80211.c
+++ b/freebsd/sbin/ifconfig/ifieee80211.c
@@ -99,6 +99,8 @@
#include <unistd.h>
#include <stdarg.h>
#include <stddef.h> /* NB: for offsetof */
+#include <locale.h>
+#include <langinfo.h>
#include "ifconfig.h"
@@ -3510,7 +3512,7 @@ list_scan(int s)
#endif /* __rtems__ */
char ssid[IEEE80211_NWID_LEN+1];
const uint8_t *cp;
- int len, ssidmax, idlen;
+ int len, idlen;
if (get80211len(s, IEEE80211_IOC_SCAN_RESULTS, buf, sizeof(buf), &len) < 0)
errx(1, "unable to get scan results");
@@ -3519,9 +3521,8 @@ list_scan(int s)
getchaninfo(s);
- ssidmax = verbose ? IEEE80211_NWID_LEN : 32;
printf("%-*.*s %-17.17s %4s %4s %-7s %3s %4s\n"
- , ssidmax, ssidmax, "SSID/MESH ID"
+ , IEEE80211_NWID_LEN, IEEE80211_NWID_LEN, "SSID/MESH ID"
, "BSSID"
, "CHAN"
, "RATE"
@@ -3544,8 +3545,8 @@ list_scan(int s)
idlen = sr->isr_ssid_len;
}
printf("%-*.*s %s %3d %3dM %4d:%-4d %4d %-4.4s"
- , ssidmax
- , copy_essid(ssid, ssidmax, idp, idlen)
+ , IEEE80211_NWID_LEN
+ , copy_essid(ssid, IEEE80211_NWID_LEN, idp, idlen)
, ssid
, ether_ntoa((const struct ether_addr *) sr->isr_bssid)
, ieee80211_mhz2ieee(sr->isr_freq, sr->isr_flags)
@@ -5399,16 +5400,21 @@ print_string(const u_int8_t *buf, int len)
{
int i;
int hasspc;
+ int utf8;
i = 0;
hasspc = 0;
+
+ setlocale(LC_CTYPE, "");
+ utf8 = strncmp("UTF-8", nl_langinfo(CODESET), 5) == 0;
+
for (; i < len; i++) {
- if (!isprint(buf[i]) && buf[i] != '\0')
+ if (!isprint(buf[i]) && buf[i] != '\0' && !utf8)
break;
if (isspace(buf[i]))
hasspc++;
}
- if (i == len) {
+ if (i == len || utf8) {
if (hasspc || len == 0 || buf[0] == '\0')
printf("\"%.*s\"", len, buf);
else