Fixes syntax and compile errors in src/apache.c
[collectd.git] / src / battery.c
index 6c7e2b5..21b19bb 100644 (file)
@@ -60,8 +60,10 @@ static char *ds_def_charge[] =
 };
 static int ds_num_charge = 1;
 
+#if BATTERY_HAVE_READ
 static int   battery_pmu_num = 0;
 static char *battery_pmu_file = "/proc/pmu/battery_%i";
+#endif
 
 static void battery_init (void)
 {
@@ -285,22 +287,22 @@ static void battery_read (void)
                                if (numfields < 3)
                                        continue;
 
-                               if ((strcmp (fields[0], "present"))
-                                               && (strcmp (fields[1], "rate:")))
+                               if ((strcmp (fields[0], "present") == 0)
+                                               && (strcmp (fields[1], "rate:") == 0))
                                        valptr = &current;
-                               else if ((strcmp (fields[0], "remaining"))
-                                               && (strcmp (fields[1], "capacity:")))
+                               else if ((strcmp (fields[0], "remaining") == 0)
+                                               && (strcmp (fields[1], "capacity:") == 0))
                                        valptr = &charge;
-                               else if ((strcmp (fields[0], "present"))
-                                               && (strcmp (fields[1], "voltage:")))
+                               else if ((strcmp (fields[0], "present") == 0)
+                                               && (strcmp (fields[1], "voltage:") == 0))
                                        valptr = &voltage;
                                else
                                        valptr = NULL;
 
-                               if ((strcmp (fields[0], "charging"))
-                                               && (strcmp (fields[1], "state:")))
+                               if ((strcmp (fields[0], "charging") == 0)
+                                               && (strcmp (fields[1], "state:") == 0))
                                {
-                                       if (strcmp (fields[2], "charging"))
+                                       if (strcmp (fields[2], "charging") == 0)
                                                charging = 1;
                                        else
                                                charging = 0;