summaryrefslogtreecommitdiff
path: root/src/get_load.c
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2009-07-21 20:26:53 +0200
committerMichael Stapelberg <michael@stapelberg.de>2009-07-21 20:26:53 +0200
commit230f3167b70b5d73b3d9c0c650c9a654c06ccb51 (patch)
treeffb0bd3f9abc4c5c9bd88c566ae5a08078662f17 /src/get_load.c
parent34ba9fa9083c655e5ba06cecd46da157eb07d980 (diff)
Add modelines and retab! all files
Diffstat (limited to 'src/get_load.c')
-rw-r--r--src/get_load.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/get_load.c b/src/get_load.c
index 7d5349f..4f82813 100644
--- a/src/get_load.c
+++ b/src/get_load.c
@@ -1,25 +1,26 @@
+// vim:ts=8:expandtab
#include "i3status.h"
const char *get_load() {
- static char part[512];
+ static char part[512];
/* Get load */
#ifdef LINUX
- slurp("/proc/loadavg", part, sizeof(part));
- *skip_character(part, ' ', 3) = '\0';
+ slurp("/proc/loadavg", part, sizeof(part));
+ *skip_character(part, ' ', 3) = '\0';
#else
- /* TODO: correctly check for NetBSD, check if it works the same on *BSD */
- struct loadavg load;
- size_t length = sizeof(struct loadavg);
- int mib[2] = { CTL_VM, VM_LOADAVG };
- if (sysctl(mib, 2, &load, &length, NULL, 0) < 0)
- die("Could not sysctl({ CTL_VM, VM_LOADAVG })\n");
- double scale = load.fscale;
- (void)snprintf(part, sizeof(part), "%.02f %.02f %.02f",
- (double)load.ldavg[0] / scale,
- (double)load.ldavg[1] / scale,
- (double)load.ldavg[2] / scale);
+ /* TODO: correctly check for NetBSD, check if it works the same on *BSD */
+ struct loadavg load;
+ size_t length = sizeof(struct loadavg);
+ int mib[2] = { CTL_VM, VM_LOADAVG };
+ if (sysctl(mib, 2, &load, &length, NULL, 0) < 0)
+ die("Could not sysctl({ CTL_VM, VM_LOADAVG })\n");
+ double scale = load.fscale;
+ (void)snprintf(part, sizeof(part), "%.02f %.02f %.02f",
+ (double)load.ldavg[0] / scale,
+ (double)load.ldavg[1] / scale,
+ (double)load.ldavg[2] / scale);
#endif
- return part;
+ return part;
}