]> git.sur5r.net Git - i3/i3status/blobdiff - src/print_cpu_temperature.c
fix ethernet speed display for 100 Gbit/s cards
[i3/i3status] / src / print_cpu_temperature.c
index feae3ec8a8cb388fc3e8717554d4f851303d65ef..01744a14fac57293768b163bd545fa6f0229904f 100644 (file)
@@ -1,4 +1,5 @@
 // vim:ts=4:sw=4:expandtab
+#include <config.h>
 #include <stdlib.h>
 #include <limits.h>
 #include <glob.h>
@@ -52,7 +53,7 @@ typedef struct temperature_s {
 #define ERROR_CODE 1
 
 static int read_temperature(char *thermal_zone, temperature_t *temperature) {
-#if defined(LINUX)
+#if defined(__linux__)
     static char buf[16];
     long int temp;
 
@@ -250,11 +251,13 @@ void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const
     for (walk = selected_format; *walk != '\0'; walk++) {
         if (*walk != '%') {
             *(outwalk++) = *walk;
-            continue;
-        }
-        if (BEGINS_WITH(walk + 1, "degrees")) {
+
+        } else if (BEGINS_WITH(walk + 1, "degrees")) {
             outwalk += sprintf(outwalk, "%s", temperature.formatted_value);
             walk += strlen("degrees");
+
+        } else {
+            *(outwalk++) = '%';
         }
     }