Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F156952210
D32847.id98064.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D32847.id98064.diff
View Options
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -69,6 +69,7 @@
#ifdef JAIL
#include <jail.h>
#endif
+#include <locale.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -423,6 +424,8 @@
f_inet = f_inet6 = f_ether = f_addr = NULL;
matchgroup = nogroup = NULL;
+ setlocale(LC_CTYPE, "");
+
lifh = ifconfig_open();
if (lifh == NULL)
err(EXIT_FAILURE, "ifconfig_open");
diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c
--- a/sbin/ifconfig/ifieee80211.c
+++ b/sbin/ifconfig/ifieee80211.c
@@ -91,8 +91,8 @@
#include <unistd.h>
#include <stdarg.h>
#include <stddef.h> /* NB: for offsetof */
-#include <locale.h>
#include <langinfo.h>
+#include <wchar.h>
#include "ifconfig.h"
@@ -3457,7 +3457,7 @@
maxlen = essid_len;
/* determine printable or not */
for (i = 0, p = essid; i < maxlen; i++, p++) {
- if (*p < ' ' || *p > 0x7e)
+ if (*p < ' ')
break;
}
if (i != maxlen) { /* not printable, print as hex */
@@ -3716,6 +3716,20 @@
mi->ch[3].noise[0]);
}
+static int
+get_visible_width(const char *str, int len)
+{
+ const char *end = str + len;
+ int adv, vw;
+ wchar_t wc;
+
+ mbtowc(NULL, 0, 0); /* reset any previous conversion state */
+
+ for (vw = 0; (adv = mbtowc(&wc, str, end - str)) > 0; str += adv)
+ vw += wcwidth(wc);
+ return (vw);
+}
+
static void
list_scan(int s)
{
@@ -3744,6 +3758,7 @@
do {
const struct ieee80211req_scan_result *sr;
const uint8_t *vp, *idp;
+ int length;
sr = (const struct ieee80211req_scan_result *) cp;
vp = cp + sr->isr_ie_off;
@@ -3754,9 +3769,12 @@
idp = vp;
idlen = sr->isr_ssid_len;
}
+
+ length = copy_essid(ssid, IEEE80211_NWID_LEN, idp, idlen);
printf("%-*.*s %s %3d %3dM %4d:%-4d %4d %-4.4s"
- , IEEE80211_NWID_LEN
- , copy_essid(ssid, IEEE80211_NWID_LEN, idp, idlen)
+ , IEEE80211_NWID_LEN + length -
+ get_visible_width(ssid, length)
+ , length
, ssid
, ether_ntoa((const struct ether_addr *) sr->isr_bssid)
, ieee80211_mhz2ieee(sr->isr_freq, sr->isr_flags)
@@ -5681,7 +5699,6 @@
i = 0;
hasspc = 0;
- setlocale(LC_CTYPE, "");
utf8 = strncmp("UTF-8", nl_langinfo(CODESET), 5) == 0;
for (; i < len; i++) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, May 18, 2:49 PM (3 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33252745
Default Alt Text
D32847.id98064.diff (2 KB)
Attached To
Mode
D32847: ifconfig(8) list scan: display non-Latin AP names and account for CJK character width
Attached
Detach File
Event Timeline
Log In to Comment