summaryrefslogtreecommitdiff
path: root/src/print_wireless_info.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/print_wireless_info.c')
-rw-r--r--src/print_wireless_info.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/print_wireless_info.c b/src/print_wireless_info.c
index 1d87c79..8b2d210 100644
--- a/src/print_wireless_info.c
+++ b/src/print_wireless_info.c
@@ -1,10 +1,13 @@
// 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>
@@ -16,14 +19,12 @@
#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>
@@ -36,7 +37,6 @@
#ifdef __DragonFly__
#include <sys/param.h>
#include <sys/ioctl.h>
-#include <sys/socket.h>
#include <ifaddrs.h>
#include <stdlib.h>
#include <net/if.h>
@@ -49,7 +49,6 @@
#ifdef __OpenBSD__
#include <sys/ioctl.h>
-#include <sys/socket.h>
#include <net/if.h>
#include <sys/select.h>
#include <sys/types.h>
@@ -81,7 +80,7 @@ typedef struct {
#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;
@@ -95,7 +94,7 @@ typedef struct {
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;
@@ -275,7 +274,7 @@ static int gwi_scan_cb(struct nl_msg *msg, void *data) {
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;
@@ -589,7 +588,7 @@ void print_wireless_info(yajl_gen json_gen, char *buffer, const char *interface,
outwalk += sprintf(outwalk, "%s", ip_address);
walk += strlen("ip");
}
-#ifdef LINUX
+#ifdef __linux__
else if (BEGINS_WITH(walk + 1, "bitrate")) {
char br_buffer[128];