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:
Aaron Marcher 2016-08-16 11:41:43 +02:00 committed by Aaron Marcher (drkhsh)
parent ec35376127
commit ad8ab20c63
5 changed files with 471 additions and 477 deletions

View File

@ -1,4 +1,4 @@
Contributing 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).

View File

@ -44,8 +44,9 @@ smprintf(const char *fmt, ...)
char *ret = NULL; char *ret = NULL;
va_start(fmtargs, fmt); va_start(fmtargs, fmt);
if (vasprintf(&ret, fmt, fmtargs) < 0) if (vasprintf(&ret, fmt, fmtargs) < 0) {
return NULL; return NULL;
}
va_end(fmtargs); va_end(fmtargs);
return ret; return ret;
@ -313,24 +314,21 @@ ip(const char *interface)
char host[NI_MAXHOST]; char host[NI_MAXHOST];
/* check if getting ip address works */ /* check if getting ip address works */
if (getifaddrs(&ifaddr) == -1) if (getifaddrs(&ifaddr) == -1) {
{
fprintf(stderr, "Error getting IP address."); fprintf(stderr, "Error getting IP address.");
return smprintf("n/a"); return smprintf("n/a");
} }
/* get the ip address */ /* get the ip address */
for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
{ if (ifa->ifa_addr == NULL) {
if (ifa->ifa_addr == NULL)
continue; continue;
}
s = getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST); 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 ((strcmp(ifa->ifa_name, interface) == 0) && (ifa->ifa_addr->sa_family == AF_INET)) {
{ if (s != 0) {
if (s != 0)
{
fprintf(stderr, "Error getting IP address."); fprintf(stderr, "Error getting IP address.");
return smprintf("n/a"); return smprintf("n/a");
} }
@ -522,8 +520,7 @@ username(const char *null)
/* if it worked, return */ /* if it worked, return */
if (pw) { if (pw) {
return smprintf("%s", pw->pw_name); return smprintf("%s", pw->pw_name);
} } else {
else {
fprintf(stderr, "Could not get username.\n"); fprintf(stderr, "Could not get username.\n");
return smprintf("n/a"); return smprintf("n/a");
} }
@ -543,8 +540,7 @@ uid(const char *null)
/* if it worked, return */ /* if it worked, return */
if (uid) { if (uid) {
return smprintf("%d", uid); return smprintf("%d", uid);
} } else {
else {
fprintf(stderr, "Could not get uid.\n"); fprintf(stderr, "Could not get uid.\n");
return smprintf("n/a"); return smprintf("n/a");
} }
@ -601,8 +597,7 @@ vol_perc(const char *soundcard)
/* return the string (mute) */ /* return the string (mute) */
if (!mute) { if (!mute) {
return smprintf("mute"); return smprintf("mute");
} } else {
else {
return smprintf("%d%%", (vol * 100) / max); return smprintf("%d%%", (vol * 100) / max);
} }
} }
@ -696,8 +691,7 @@ wifi_essid(const char *wificard)
/* return the essid */ /* return the essid */
if (strcmp((char *)wreq.u.essid.pointer, "") == 0) { if (strcmp((char *)wreq.u.essid.pointer, "") == 0) {
return smprintf("n/a"); return smprintf("n/a");
} } else {
else {
return smprintf("%s", (char *)wreq.u.essid.pointer); return smprintf("%s", (char *)wreq.u.essid.pointer);
} }
} }