Xinqi Bao's Git
projects
/
slstatus.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
cpu_perc: Port to OpenBSD
[slstatus.git]
/
components
/
wifi.c
diff --git
a/components/wifi.c
b/components/wifi.c
index
33e09b7
..
7cd2702
100644
(file)
--- a/
components/wifi.c
+++ b/
components/wifi.c
@@
-25,8
+25,7
@@
snprintf(path, sizeof(path), "%s%s%s", "/sys/class/net/", iface,
"/operstate");
snprintf(path, sizeof(path), "%s%s%s", "/sys/class/net/", iface,
"/operstate");
- fp = fopen(path, "r");
- if (fp == NULL) {
+ if (!(fp = fopen(path, "r"))) {
fprintf(stderr, "fopen '%s': %s\n", path,
strerror(errno));
return NULL;
fprintf(stderr, "fopen '%s': %s\n", path,
strerror(errno));
return NULL;
@@
-37,8
+36,7
@@
return NULL;
}
return NULL;
}
- fp = fopen("/proc/net/wireless", "r");
- if (fp == NULL) {
+ if (!(fp = fopen("/proc/net/wireless", "r"))) {
fprintf(stderr, "fopen '/proc/net/wireless': %s\n",
strerror(errno));
return NULL;
fprintf(stderr, "fopen '/proc/net/wireless': %s\n",
strerror(errno));
return NULL;
@@
-92,8
+90,8
@@
if (strcmp(id, "") == 0)
return NULL;
if (strcmp(id, "") == 0)
return NULL;
- else
-
return id;
+
+ return id;
}
#elif defined(__OpenBSD__)
/* unimplemented */
}
#elif defined(__OpenBSD__)
/* unimplemented */