From 4189824ffb6b8090f36e40b1d7939764ea834540 Mon Sep 17 00:00:00 2001 From: Tommie Gannert Date: Mon, 1 Aug 2016 11:29:18 +0100 Subject: Define IW_ESSID_MAX_SIZE for OpenBSD. Also fixes a signedness warning. --- src/print_wireless_info.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/print_wireless_info.c') diff --git a/src/print_wireless_info.c b/src/print_wireless_info.c index 25e167f..70dbdb4 100644 --- a/src/print_wireless_info.c +++ b/src/print_wireless_info.c @@ -54,6 +54,7 @@ #include #include #include +#define IW_ESSID_MAX_SIZE IEEE80211_NWID_LEN #endif #include "i3status.h" @@ -423,7 +424,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; } -- cgit v1.2.3 From 7728cff37044943b05c4f9de5e9c6ef3d9e14a12 Mon Sep 17 00:00:00 2001 From: Tommie Gannert Date: Mon, 1 Aug 2016 14:34:39 +0100 Subject: Make print_disk_info, print_eth_info and print_wireless_info compile on NetBSD without warnings. --- src/print_disk_info.c | 6 ++++++ src/print_eth_info.c | 2 +- src/print_wireless_info.c | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src/print_wireless_info.c') diff --git a/src/print_disk_info.c b/src/print_disk_info.c index 629e05b..edc69ac 100644 --- a/src/print_disk_info.c +++ b/src/print_disk_info.c @@ -10,6 +10,7 @@ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || (__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__) #include #include +#elif defined(__NetBSD__) #else #include #endif @@ -121,6 +122,11 @@ void print_disk_info(yajl_gen json_gen, char *buffer, const char *path, const ch if (statfs(path, &buf) == -1) return; +#elif defined(__NetBSD__) + struct statvfs buf; + + if (statvfs(path, &buf) == -1) + return; #else struct statvfs buf; diff --git a/src/print_eth_info.c b/src/print_eth_info.c index 34ffa36..e4bf15e 100644 --- a/src/print_eth_info.c +++ b/src/print_eth_info.c @@ -79,7 +79,7 @@ static int print_eth_speed(char *outwalk, const char *interface) { ethspeed = (desc->ifmt_string != NULL ? desc->ifmt_string : "?"); return sprintf(outwalk, "%s", ethspeed); #elif defined(__OpenBSD__) || defined(__NetBSD__) - char *ethspeed; + const char *ethspeed; struct ifmediareq ifmr; (void)memset(&ifmr, 0, sizeof(ifmr)); diff --git a/src/print_wireless_info.c b/src/print_wireless_info.c index 70dbdb4..14879eb 100644 --- a/src/print_wireless_info.c +++ b/src/print_wireless_info.c @@ -57,6 +57,12 @@ #define IW_ESSID_MAX_SIZE IEEE80211_NWID_LEN #endif +#ifdef __NetBSD__ +#include +#include +#define IW_ESSID_MAX_SIZE IEEE80211_NWID_LEN +#endif + #include "i3status.h" #define WIRELESS_INFO_FLAG_HAS_ESSID (1 << 0) -- cgit v1.2.3