radical re-formatting 2/3: Fix blocks
Fixes coding style. Formatting commits suck, incoherent coding style sucks more. https://suckless.org/coding_style/
This commit is contained in:
@ -38,27 +38,24 @@
|
||||
}
|
||||
p = fgets(status, 5, fp);
|
||||
fclose(fp);
|
||||
if (!p || strcmp(status, "up\n") != 0) {
|
||||
if (!p || strcmp(status, "up\n") != 0)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(fp = fopen("/proc/net/wireless", "r"))) {
|
||||
warn("fopen '/proc/net/wireless':");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (i = 0; i < 3; i++)
|
||||
if (!(p = fgets(buf, sizeof(buf) - 1, fp)))
|
||||
break;
|
||||
}
|
||||
fclose(fp);
|
||||
if (i < 2 || !p) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(datastart = strstr(buf, interface))) {
|
||||
fclose(fp);
|
||||
if (i < 2 || !p)
|
||||
return NULL;
|
||||
|
||||
if (!(datastart = strstr(buf, interface)))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
datastart = (datastart+(strlen(interface)+1));
|
||||
sscanf(datastart + 1, " %*d %d %*d %*d\t\t %*d\t "
|
||||
@ -78,9 +75,8 @@
|
||||
memset(&wreq, 0, sizeof(struct iwreq));
|
||||
wreq.u.essid.length = IW_ESSID_MAX_SIZE+1;
|
||||
if (esnprintf(wreq.ifr_name, sizeof(wreq.ifr_name), "%s",
|
||||
interface) < 0) {
|
||||
interface) < 0)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
|
||||
warn("socket 'AF_INET':");
|
||||
@ -95,9 +91,8 @@
|
||||
|
||||
close(sockfd);
|
||||
|
||||
if (!strcmp(id, "")) {
|
||||
if (!strcmp(id, ""))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
@ -153,11 +148,11 @@
|
||||
int q;
|
||||
|
||||
if (load_ieee80211_nodereq(interface, &nr)) {
|
||||
if (nr.nr_max_rssi) {
|
||||
if (nr.nr_max_rssi)
|
||||
q = IEEE80211_NODEREQ_RSSI(&nr);
|
||||
} else {
|
||||
else
|
||||
q = RSSI_TO_PERC(nr.nr_rssi);
|
||||
}
|
||||
|
||||
return bprintf("%d", q);
|
||||
}
|
||||
|
||||
@ -169,9 +164,8 @@
|
||||
{
|
||||
struct ieee80211_nodereq nr;
|
||||
|
||||
if (load_ieee80211_nodereq(interface, &nr)) {
|
||||
if (load_ieee80211_nodereq(interface, &nr))
|
||||
return bprintf("%s", nr.nr_nwid);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user