summaryrefslogtreecommitdiff
path: root/wmiistatus.c
diff options
context:
space:
mode:
authorMichael Stapelberg <michael+x200@stapelberg.de>2008-10-07 11:54:04 +0200
committerMichael Stapelberg <michael+x200@stapelberg.de>2008-10-07 11:54:04 +0200
commit6f705c20decfca58aa1cd2e6c459aae01f50b318 (patch)
tree664c9c61933e3dad6bc7d33703f9fee23cc63afc /wmiistatus.c
parent7fa8c4b9a954647db79f79b78b33d79c00acd250 (diff)
Make runwatches work again
Diffstat (limited to 'wmiistatus.c')
-rw-r--r--wmiistatus.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/wmiistatus.c b/wmiistatus.c
index c26781a..c47b528 100644
--- a/wmiistatus.c
+++ b/wmiistatus.c
@@ -124,14 +124,6 @@ static char *skip_character(char *input, char character, int amount) {
return (walk == input ? walk : walk-1);
}
-static void push_part(const char *input, const int n) {
- if (first_push)
- first_push = false;
- else
- strncpy(output+strlen(output), " | ", strlen(" | "));
- strncpy(output+strlen(output), input, n);
-}
-
/*
* Get battery information from /sys. Note that it uses the design capacity to calculate the percentage,
* not the full capacity.
@@ -311,6 +303,7 @@ static bool process_runs(const char *path) {
int main(void) {
char part[512],
+ pathbuf[512],
*end;
unsigned int i;
@@ -320,24 +313,21 @@ int main(void) {
create_file(ORDER_BATTERY "battery");
create_file(ORDER_LOAD "load");
create_file(ORDER_TIME "time");
+ for (i = 0; i < sizeof(run_watches) / sizeof(char*); i += 2) {
+ sprintf(pathbuf, "%s%s", ORDER_RUN, run_watches[i]);
+ create_file(pathbuf);
+ }
while (1) {
- memset(output, '\0', sizeof(output));
- first_push = true;
-
for (i = 0; i < sizeof(run_watches) / sizeof(char*); i += 2) {
sprintf(part, "%s: %s", run_watches[i], (process_runs(run_watches[i+1]) ? "yes" : "no"));
- push_part(part, strlen(part));
+ sprintf(pathbuf, "%s%s", ORDER_RUN, run_watches[i]);
+ write_to_statusbar(pathbuf, part);
}
- char *wireless_info = get_wireless_info();
- write_to_statusbar(ORDER_WLAN "wlan", wireless_info);
-
- char *eth_info = get_eth_info();
- write_to_statusbar(ORDER_ETH "eth", eth_info);
-
- char *battery_info = get_battery_info();
- write_to_statusbar(ORDER_BATTERY "battery", battery_info);
+ write_to_statusbar(ORDER_WLAN "wlan", get_wireless_info());
+ write_to_statusbar(ORDER_ETH "eth", get_eth_info());
+ write_to_statusbar(ORDER_BATTERY "battery", get_battery_info());
/* Get load */
int load_avg = open("/proc/loadavg", O_RDONLY);