]> git.sur5r.net Git - i3/i3status/blobdiff - src/print_wireless_info.c
Move full_design and full_last into struct battery_info.
[i3/i3status] / src / print_wireless_info.c
index aff04383ed43ac0a7294eb2a04e0d74de99348aa..14879ebf7cbccb5b077e040c52afb5b309f765e4 100644 (file)
 #define IW_ESSID_MAX_SIZE 32
 #endif
 
+#ifdef __APPLE__
+#define IW_ESSID_MAX_SIZE 32
+#endif
+
 #ifdef __FreeBSD__
 #include <sys/param.h>
 #include <sys/ioctl.h>
 #include <netinet/if_ether.h>
 #include <net80211/ieee80211.h>
 #include <net80211/ieee80211_ioctl.h>
+#define IW_ESSID_MAX_SIZE IEEE80211_NWID_LEN
+#endif
+
+#ifdef __NetBSD__
+#include <sys/types.h>
+#include <net80211/ieee80211.h>
+#define IW_ESSID_MAX_SIZE IEEE80211_NWID_LEN
 #endif
 
 #include "i3status.h"
@@ -419,7 +430,7 @@ error1:
         else
             len = IEEE80211_NWID_LEN + 1;
 
-        strncpy(&info->essid[0], nwid.i_nwid, len);
+        strncpy(&info->essid[0], (char *)nwid.i_nwid, len);
         info->essid[IW_ESSID_MAX_SIZE] = '\0';
         info->flags |= WIRELESS_INFO_FLAG_HAS_ESSID;
     }
@@ -519,7 +530,7 @@ void print_wireless_info(yajl_gen json_gen, char *buffer, const char *interface,
 
         if (BEGINS_WITH(walk + 1, "essid")) {
             if (info.flags & WIRELESS_INFO_FLAG_HAS_ESSID)
-                outwalk += sprintf(outwalk, "%s", info.essid);
+                maybe_escape_markup(info.essid, &outwalk);
             else
                 *(outwalk++) = '?';
             walk += strlen("essid");