summaryrefslogtreecommitdiff
path: root/components/wifi.c
diff options
context:
space:
mode:
authorAaron Marcher <me@drkhsh.at>2018-03-28 18:26:56 +0200
committerAaron Marcher <me@drkhsh.at>2018-03-28 18:26:56 +0200
commit96f3a8a54eeb3b2294ed953dad8b15349f3e2703 (patch)
tree26446375bc7c3e64769c1da43b37671da77e80ed /components/wifi.c
parentaced8326228ea3cf1673828a6e488b8f75108f45 (diff)
Get rid of err.h as it is not portable
Replace warn() and warnx() with fprintf() and add <stdio.h> where necessary.
Diffstat (limited to 'components/wifi.c')
-rw-r--r--components/wifi.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/components/wifi.c b/components/wifi.c
index a02c277..500332e 100644
--- a/components/wifi.c
+++ b/components/wifi.c
@@ -1,6 +1,5 @@
/* See LICENSE file for copyright and license details. */
#if defined(__linux__)
-#include <err.h>
#include <ifaddrs.h>
#include <linux/wireless.h>
#include <sys/socket.h>
@@ -26,7 +25,7 @@ wifi_perc(const char *iface)
snprintf(path, sizeof(path), "%s%s%s", "/sys/class/net/", iface, "/operstate");
fp = fopen(path, "r");
if (fp == NULL) {
- warn("Failed to open file %s", path);
+ fprintf(stderr, "Failed to open file %s", path);
return NULL;
}
p = fgets(status, 5, fp);
@@ -37,7 +36,7 @@ wifi_perc(const char *iface)
fp = fopen("/proc/net/wireless", "r");
if (fp == NULL) {
- warn("Failed to open file /proc/net/wireless");
+ fprintf(stderr, "Failed to open file /proc/net/wireless");
return NULL;
}
@@ -72,12 +71,12 @@ wifi_essid(const char *iface)
snprintf(wreq.ifr_name, sizeof(wreq.ifr_name), "%s", iface);
if (sockfd == -1) {
- warn("Failed to get ESSID for interface %s", iface);
+ fprintf(stderr, "Failed to get ESSID for interface %s", iface);
return NULL;
}
wreq.u.essid.pointer = id;
if (ioctl(sockfd,SIOCGIWESSID, &wreq) == -1) {
- warn("Failed to get ESSID for interface %s", iface);
+ fprintf(stderr, "Failed to get ESSID for interface %s", iface);
close(sockfd);
return NULL;
}