all repos — slstatus @ 51ff7ce2b99147a1a77ed243093865fc884e571a

my build of slstatus (tools.suckless.org/slstatus/)

Consistent paramter naming for components
Aaron Marcher me@drkhsh.at
Fri, 06 Jul 2018 08:08:48 +0200
commit

51ff7ce2b99147a1a77ed243093865fc884e571a

parent

efa26f4f3548bce8086abcd8de7ca135169e6f37

5 files changed, 43 insertions(+), 43 deletions(-)

jump to
M components/disk.ccomponents/disk.c

@@ -5,12 +5,12 @@

#include "../util.h" const char * -disk_free(const char *mnt) +disk_free(const char *path) { struct statvfs fs; - if (statvfs(mnt, &fs) < 0) { - warn("statvfs '%s':", mnt); + if (statvfs(path, &fs) < 0) { + warn("statvfs '%s':", path); return NULL; }

@@ -18,12 +18,12 @@ return fmt_human(fs.f_frsize * fs.f_bavail, 1024);

} const char * -disk_perc(const char *mnt) +disk_perc(const char *path) { struct statvfs fs; - if (statvfs(mnt, &fs) < 0) { - warn("statvfs '%s':", mnt); + if (statvfs(path, &fs) < 0) { + warn("statvfs '%s':", path); return NULL; }

@@ -32,12 +32,12 @@ (1.0f - ((float)fs.f_bavail / (float)fs.f_blocks))));

} const char * -disk_total(const char *mnt) +disk_total(const char *path) { struct statvfs fs; - if (statvfs(mnt, &fs) < 0) { - warn("statvfs '%s':", mnt); + if (statvfs(path, &fs) < 0) { + warn("statvfs '%s':", path); return NULL; }

@@ -45,12 +45,12 @@ return fmt_human(fs.f_frsize * fs.f_blocks, 1024);

} const char * -disk_used(const char *mnt) +disk_used(const char *path) { struct statvfs fs; - if (statvfs(mnt, &fs) < 0) { - warn("statvfs '%s':", mnt); + if (statvfs(path, &fs) < 0) { + warn("statvfs '%s':", path); return NULL; }
M components/ip.ccomponents/ip.c

@@ -11,7 +11,7 @@

#include "../util.h" static const char * -ip(const char *iface, unsigned short sa_family) +ip(const char *interface, unsigned short sa_family) { struct ifaddrs *ifaddr, *ifa; int s;

@@ -28,7 +28,7 @@ continue;

} s = getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in6), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST); - if (!strcmp(ifa->ifa_name, iface) && + if (!strcmp(ifa->ifa_name, interface) && (ifa->ifa_addr->sa_family == sa_family)) { freeifaddrs(ifaddr); if (s != 0) {

@@ -45,13 +45,13 @@ return NULL;

} const char * -ipv4(const char *iface) +ipv4(const char *interface) { - return ip(iface, AF_INET); + return ip(interface, AF_INET); } const char * -ipv6(const char *iface) +ipv6(const char *interface) { - return ip(iface, AF_INET6); + return ip(interface, AF_INET6); }
M components/num_files.ccomponents/num_files.c

@@ -6,14 +6,14 @@

#include "../util.h" const char * -num_files(const char *dir) +num_files(const char *path) { struct dirent *dp; DIR *fd; int num; - if (!(fd = opendir(dir))) { - warn("opendir '%s':", dir); + if (!(fd = opendir(path))) { + warn("opendir '%s':", path); return NULL; }
M components/wifi.ccomponents/wifi.c

@@ -13,7 +13,7 @@ #include <limits.h>

#include <linux/wireless.h> const char * - wifi_perc(const char *iface) + wifi_perc(const char *interface) { int i, cur; int total = 70; /* the max of /proc/net/wireless */

@@ -24,7 +24,7 @@ FILE *fp;

if (esnprintf(path, sizeof(path), "/sys/class/net/%s/operstate", - iface) < 0) { + interface) < 0) { return NULL; } if (!(fp = fopen(path, "r"))) {

@@ -51,11 +51,11 @@ if (i < 2 || !p) {

return NULL; } - if (!(datastart = strstr(buf, iface))) { + if (!(datastart = strstr(buf, interface))) { return NULL; } - datastart = (datastart+(strlen(iface)+1)); + datastart = (datastart+(strlen(interface)+1)); sscanf(datastart + 1, " %*d %d %*d %*d\t\t %*d\t " "%*d\t\t%*d\t\t %*d\t %*d\t\t %*d", &cur);

@@ -63,7 +63,7 @@ return bprintf("%d", (int)((float)cur / total * 100));

} const char * - wifi_essid(const char *iface) + wifi_essid(const char *interface) { static char id[IW_ESSID_MAX_SIZE+1]; int sockfd;

@@ -72,7 +72,7 @@

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", iface) < 0) { + "%s", interface) < 0) { return NULL; }

@@ -105,7 +105,7 @@ #include <stdlib.h>

#include <sys/types.h> static int - load_ieee80211_nodereq(const char *iface, struct ieee80211_nodereq *nr) + load_ieee80211_nodereq(const char *interface, struct ieee80211_nodereq *nr) { struct ieee80211_bssid bssid; int sockfd;

@@ -117,7 +117,7 @@ if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {

warn("socket 'AF_INET':"); return 0; } - strlcpy(bssid.i_name, iface, sizeof(bssid.i_name)); + strlcpy(bssid.i_name, interface, sizeof(bssid.i_name)); if ((ioctl(sockfd, SIOCG80211BSSID, &bssid)) < 0) { warn("ioctl 'SIOCG80211BSSID':"); close(sockfd);

@@ -129,7 +129,7 @@ IEEE80211_ADDR_LEN) == 0) {

close(sockfd); return 0; } - strlcpy(nr->nr_ifname, iface, sizeof(nr->nr_ifname)); + strlcpy(nr->nr_ifname, interface, sizeof(nr->nr_ifname)); memcpy(&nr->nr_macaddr, bssid.i_bssid, sizeof(nr->nr_macaddr)); if ((ioctl(sockfd, SIOCG80211NODE, nr)) < 0 && nr->nr_rssi) { warn("ioctl 'SIOCG80211NODE':");

@@ -141,12 +141,12 @@ return close(sockfd), 1;

} const char * - wifi_perc(const char *iface) + wifi_perc(const char *interface) { struct ieee80211_nodereq nr; int q; - if (load_ieee80211_nodereq(iface, &nr)) { + if (load_ieee80211_nodereq(interface, &nr)) { if (nr.nr_max_rssi) { q = IEEE80211_NODEREQ_RSSI(&nr); } else {

@@ -160,11 +160,11 @@ return NULL;

} const char * - wifi_essid(const char *iface) + wifi_essid(const char *interface) { struct ieee80211_nodereq nr; - if (load_ieee80211_nodereq(iface, &nr)) { + if (load_ieee80211_nodereq(interface, &nr)) { return bprintf("%s", nr.nr_nwid); }
M slstatus.hslstatus.h

@@ -13,10 +13,10 @@ /* datetime */

const char *datetime(const char *fmt); /* disk */ -const char *disk_free(const char *mnt); -const char *disk_perc(const char *mnt); -const char *disk_total(const char *mnt); -const char *disk_used(const char *mnt); +const char *disk_free(const char *path); +const char *disk_perc(const char *path); +const char *disk_total(const char *path); +const char *disk_used(const char *path); /* entropy */ const char *entropy(void);

@@ -25,8 +25,8 @@ /* hostname */

const char *hostname(void); /* ip */ -const char *ipv4(const char *iface); -const char *ipv6(const char *iface); +const char *ipv4(const char *interface); +const char *ipv6(const char *interface); /* kernel_release */ const char *kernel_release(void);

@@ -45,7 +45,7 @@ const char *netspeed_rx(const char *interface);

const char *netspeed_tx(const char *interface); /* num_files */ -const char *num_files(const char *dir); +const char *num_files(const char *path); /* ram */ const char *ram_free(void);

@@ -77,5 +77,5 @@ /* volume */

const char *vol_perc(const char *card); /* wifi */ -const char *wifi_perc(const char *iface); -const char *wifi_essid(const char *iface); +const char *wifi_perc(const char *interface); +const char *wifi_essid(const char *interface);