struct featurelist *next;
} featurelist_t;
-static char *conffile = NULL;
-static _Bool use_labels = 0;
+static char *conffile;
+static bool use_labels;
+ #endif
-static featurelist_t *first_feature = NULL;
+static featurelist_t *first_feature;
static ignorelist_t *sensor_list;
-#if SENSORS_API_VERSION < 0x400
-/* full chip name logic borrowed from lm_sensors */
-static int sensors_snprintf_chip_name(char *buf, size_t buf_size,
- const sensors_chip_name *chip) {
- int status = -1;
-
- if (chip->bus == SENSORS_CHIP_NAME_BUS_ISA) {
- status = snprintf(buf, buf_size, "%s-isa-%04x", chip->prefix, chip->addr);
- } else if (chip->bus == SENSORS_CHIP_NAME_BUS_DUMMY) {
- status = snprintf(buf, buf_size, "%s-%s-%04x", chip->prefix, chip->busname,
- chip->addr);
- } else {
- status = snprintf(buf, buf_size, "%s-i2c-%d-%02x", chip->prefix, chip->bus,
- chip->addr);
- }
-
- return status;
-} /* int sensors_snprintf_chip_name */
-
-static int sensors_feature_name_to_type(const char *name) {
- /* Yes, this is slow, but it's only ever done during initialization, so
- * it's a one time cost.. */
- for (int i = 0; i < known_features_num; i++)
- if (strcasecmp(known_features[i].label, name) == 0)
- return known_features[i].type;
-
- return SENSOR_TYPE_UNKNOWN;
-} /* int sensors_feature_name_to_type */
-#endif
-
static int sensors_config(const char *key, const char *value) {
if (sensor_list == NULL)
sensor_list = ignorelist_create(1);
ignorelist_set_invert(sensor_list, 1);
if (IS_TRUE(value))
ignorelist_set_invert(sensor_list, 0);
- } else if (strcasecmp(key, "UseLabels") == 0) {
+ }
+ #if (SENSORS_API_VERSION >= 0x400)
+ else if (strcasecmp(key, "UseLabels") == 0) {
- use_labels = IS_TRUE(value) ? 1 : 0;
+ use_labels = IS_TRUE(value);
- } else {
+ }
+ #endif
+ else {
return -1;
}