mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-14 07:15:58 +08:00
Update to FreeBSD head 2018-09-17
Git mirror commit 6c2192b1ef8c50788c751f878552526800b1e319. Update #3472.
This commit is contained in:
@@ -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);
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user