// vim:ts=4:sw=4:expandtab
+#include <config.h>
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include <yajl/yajl_gen.h>
#include <yajl/yajl_version.h>
+#include <sys/socket.h>
-#ifdef LINUX
+#ifdef __linux__
#include <errno.h>
#include <net/if.h>
#include <netlink/netlink.h>
#endif
#ifdef __APPLE__
-#include <sys/socket.h>
#define IW_ESSID_MAX_SIZE 32
#endif
#ifdef __FreeBSD__
#include <sys/param.h>
#include <sys/ioctl.h>
-#include <sys/socket.h>
#include <ifaddrs.h>
#include <net/if.h>
#include <net/if_media.h>
#ifdef __DragonFly__
#include <sys/param.h>
#include <sys/ioctl.h>
-#include <sys/socket.h>
#include <ifaddrs.h>
#include <stdlib.h>
#include <net/if.h>
#ifdef __OpenBSD__
#include <sys/ioctl.h>
-#include <sys/socket.h>
#include <net/if.h>
#include <sys/select.h>
#include <sys/types.h>
#ifdef IW_ESSID_MAX_SIZE
char essid[IW_ESSID_MAX_SIZE + 1];
#endif
-#ifdef LINUX
+#ifdef __linux__
uint8_t bssid[ETH_ALEN];
#endif
int quality;
double frequency;
} wireless_info_t;
-#ifdef LINUX
+#ifdef __linux__
// Like iw_print_bitrate, but without the dependency on libiw.
static void print_bitrate(char *buffer, int buflen, int bitrate) {
const int kilo = 1e3;
static int get_wireless_info(const char *interface, wireless_info_t *info) {
memset(info, 0, sizeof(wireless_info_t));
-#ifdef LINUX
+#ifdef __linux__
struct nl_sock *sk = nl_socket_alloc();
if (genl_connect(sk) != 0)
goto error1;
outwalk += sprintf(outwalk, "%s", ip_address);
walk += strlen("ip");
}
-#ifdef LINUX
+#ifdef __linux__
else if (BEGINS_WITH(walk + 1, "bitrate")) {
char br_buffer[128];