]> git.sur5r.net Git - i3/i3status/blobdiff - include/i3status.h
Implement displaying battery status on OpenBSD.
[i3/i3status] / include / i3status.h
index 4ec0ce429807db0cd35dc1b11bd5e4b9405ee18e..a6d5fc6ce4eecec9f68dab948ae191da0166ee2e 100644 (file)
@@ -7,6 +7,7 @@ enum { O_DZEN2, O_XMOBAR, O_I3BAR, O_NONE } output_format;
 #include <confuse.h>
 #include <time.h>
 #include <yajl/yajl_gen.h>
+#include <yajl/yajl_version.h>
 #include <unistd.h>
 #include <string.h>
 
@@ -25,6 +26,15 @@ enum { O_DZEN2, O_XMOBAR, O_I3BAR, O_NONE } output_format;
 #define BATT_TIME "hw.acpi.battery.time"
 #define BATT_STATE "hw.acpi.battery.state"
 
+#elif defined(__OpenBSD__)
+/*
+ * Due to the fact there are various ways to obtain a temperature reading, THERMAL_ZONE will need
+ * to be adjustable enough for those situations. As it can either be hw.sensors.cpu%d.temp0, or
+ * hw.sensors.acpitz%d.temp0 or even something different entirely within hw.sensors.%s.temp0.
+ * XXX: For now just check cpu%d.temp0. Adjust this later.
+ */
+#define THERMAL_ZONE "cpu%d"
+
 #endif
 
 #if defined(__FreeBSD_kernel__) && defined(__GLIBC__)
@@ -61,7 +71,7 @@ enum { O_DZEN2, O_XMOBAR, O_I3BAR, O_NONE } output_format;
                        yajl_gen_string(json_gen, (const unsigned char *)"full_text", strlen("full_text")); \
                        yajl_gen_string(json_gen, (const unsigned char *)text, strlen(text)); \
                } else { \
-                       write(STDOUT_FILENO, text, strlen(text)); \
+                       printf("%s", text); \
                } \
        } while (0)