Formatting commit :(
I know formatting commits suck... And I try to avoid them. But this commit was absolutely necessary... The coding style in this program was not ok and not the same over the whole program. The commit is hard to read, but this is what I changed: - Tabs for indentation instead of spaces - Same style over the whole program (suckless style)
This commit is contained in:
parent
ec35376127
commit
ad8ab20c63
|
@ -1,4 +1,4 @@
|
|||
Contributing
|
||||
============
|
||||
|
||||
If you want to contribute, please use [the suckless coding style](http://suckless.org/coding_style) and 4 spaces for indentation.
|
||||
If you want to contribute, please use [the suckless coding style](http://suckless.org/coding_style).
|
||||
|
|
30
slstatus.c
30
slstatus.c
|
@ -44,8 +44,9 @@ smprintf(const char *fmt, ...)
|
|||
char *ret = NULL;
|
||||
|
||||
va_start(fmtargs, fmt);
|
||||
if (vasprintf(&ret, fmt, fmtargs) < 0)
|
||||
if (vasprintf(&ret, fmt, fmtargs) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
va_end(fmtargs);
|
||||
|
||||
return ret;
|
||||
|
@ -313,24 +314,21 @@ ip(const char *interface)
|
|||
char host[NI_MAXHOST];
|
||||
|
||||
/* check if getting ip address works */
|
||||
if (getifaddrs(&ifaddr) == -1)
|
||||
{
|
||||
if (getifaddrs(&ifaddr) == -1) {
|
||||
fprintf(stderr, "Error getting IP address.");
|
||||
return smprintf("n/a");
|
||||
}
|
||||
|
||||
/* get the ip address */
|
||||
for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next)
|
||||
{
|
||||
if (ifa->ifa_addr == NULL)
|
||||
for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
|
||||
if (ifa->ifa_addr == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
s = getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
|
||||
|
||||
if ((strcmp(ifa->ifa_name, interface) == 0) && (ifa->ifa_addr->sa_family == AF_INET))
|
||||
{
|
||||
if (s != 0)
|
||||
{
|
||||
if ((strcmp(ifa->ifa_name, interface) == 0) && (ifa->ifa_addr->sa_family == AF_INET)) {
|
||||
if (s != 0) {
|
||||
fprintf(stderr, "Error getting IP address.");
|
||||
return smprintf("n/a");
|
||||
}
|
||||
|
@ -522,8 +520,7 @@ username(const char *null)
|
|||
/* if it worked, return */
|
||||
if (pw) {
|
||||
return smprintf("%s", pw->pw_name);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(stderr, "Could not get username.\n");
|
||||
return smprintf("n/a");
|
||||
}
|
||||
|
@ -543,8 +540,7 @@ uid(const char *null)
|
|||
/* if it worked, return */
|
||||
if (uid) {
|
||||
return smprintf("%d", uid);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fprintf(stderr, "Could not get uid.\n");
|
||||
return smprintf("n/a");
|
||||
}
|
||||
|
@ -601,8 +597,7 @@ vol_perc(const char *soundcard)
|
|||
/* return the string (mute) */
|
||||
if (!mute) {
|
||||
return smprintf("mute");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return smprintf("%d%%", (vol * 100) / max);
|
||||
}
|
||||
}
|
||||
|
@ -696,8 +691,7 @@ wifi_essid(const char *wificard)
|
|||
/* return the essid */
|
||||
if (strcmp((char *)wreq.u.essid.pointer, "") == 0) {
|
||||
return smprintf("n/a");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return smprintf("%s", (char *)wreq.u.essid.pointer);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue