+// vim:ts=8:expandtab
#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
+#include <glob.h>
#include "i3status.h"
+int highest_order = 0;
+
/*
* Reads the configuration from the given file
*
get_ethspeed = true;
OPT("get_cpu_temperature") {
get_cpu_temperature = true;
- if (strlen(dest_value) > 0) {
- if (asprintf(&thermal_zone, "/sys/class/thermal/thermal_zone%d/temp", atoi(dest_value)) == -1)
- die("Could not build thermal_zone path\n");
- } else {
- if (asprintf(&thermal_zone, "/sys/class/thermal/thermal_zone0/temp") == -1)
- die("Could not build thermal_zone path\n");
- }
+ int zone = 0;
+ if (strlen(dest_value) > 0)
+ zone = atoi(dest_value);
+ if (asprintf(&thermal_zone, THERMAL_ZONE, zone) == -1)
+ die("Could not build thermal_zone path\n");
} OPT("normcolors")
wmii_normcolors = strdup(dest_value);
OPT("interval")
interval = atoi(dest_value);
OPT("wmii_path")
{
-#ifndef DZEN
+#if !defined(DZEN) && !defined(XMOBAR)
static glob_t globbuf;
struct stat stbuf;
if (glob(dest_value, GLOB_NOCHECK | GLOB_TILDE, NULL, &globbuf) < 0)
}
OPT("order")
{
- #define SET_ORDER(opt, idx) { if (strcasecmp(token, opt) == 0) order[idx] = c++; }
+
+ for (int c = 0; c < MAX_ORDER; c++)
+ order[c] = -1;
+
+ #define SET_ORDER(opt, idx) { if (strcasecmp(token, opt) == 0) order[idx] = highest_order++; }
char *walk, *token;
- int c = 0;
walk = token = dest_value;
while (*walk != '\0') {
while ((*walk != ',') && (*walk != '\0'))
}
fclose(handle);
-#ifndef DZEN
+#if !defined(DZEN) && !defined(XMOBAR)
if (wmii_path == NULL)
exit(EXIT_FAILURE);
#endif