#include "collectd.h"
-#include "common.h"
#include "plugin.h"
-#include "utils_ignorelist.h"
+#include "utils/common/common.h"
+#include "utils/ignorelist/ignorelist.h"
#include <owcapi.h>
#include <regex.h>
/* features_num = */ 1}};
static int ow_family_features_num = STATIC_ARRAY_SIZE(ow_family_features);
-static char *device_g = NULL;
-static cdtime_t ow_interval = 0;
-static _Bool direct_access = 0;
+static char *device_g;
+static cdtime_t ow_interval;
+static bool direct_access;
static const char *config_keys[] = {"Device", "IgnoreSelected", "Sensor",
"Interval"};
static ignorelist_t *sensor_list;
-static _Bool regex_direct_initialized = 0;
+static bool regex_direct_initialized;
static regex_t regex_direct;
/**
struct direct_access_element_s *next; /**< Next in the list */
} direct_access_element_t;
-static direct_access_element_t *direct_list = NULL;
+static direct_access_element_t *direct_list;
/* ===================================================================================
*/
direct_list_element_free(element);
return 1;
}
- regex_direct_initialized = 1;
+ regex_direct_initialized = true;
DEBUG("onewire plugin: Compiled regex!!");
}
}
} else {
DEBUG("onewire plugin: %s is a direct access", value);
- direct_access = 1;
+ direct_access = true;
}
} else if (strcasecmp(key, "IgnoreSelected") == 0) {
ignorelist_set_invert(sensor_list, 1);
char file[4096];
char *endptr;
- snprintf(file, sizeof(file), "%s/%s", path,
- family_info->features[i].filename);
- file[sizeof(file) - 1] = 0;
+ ssnprintf(file, sizeof(file), "%s/%s", path,
+ family_info->features[i].filename);
+ file[sizeof(file) - 1] = '\0';
buffer = NULL;
buffer_size = 0;
char subpath[4096];
int status;
- status = snprintf(subpath, sizeof(subpath), "%s/main", path);
+ status = ssnprintf(subpath, sizeof(subpath), "%s/main", path);
if ((status > 0) && (status < (int)sizeof(subpath)))
cow_read_bus(subpath);
- status = snprintf(subpath, sizeof(subpath), "%s/aux", path);
+ status = ssnprintf(subpath, sizeof(subpath), "%s/aux", path);
if ((status > 0) && (status < (int)sizeof(subpath)))
cow_read_bus(subpath);
dummy = NULL;
if (strcmp("/", path) == 0)
- status = snprintf(subpath, sizeof(subpath), "/%s", buffer_ptr);
+ status = ssnprintf(subpath, sizeof(subpath), "/%s", buffer_ptr);
else
- status = snprintf(subpath, sizeof(subpath), "%s/%s", path, buffer_ptr);
+ status = ssnprintf(subpath, sizeof(subpath), "%s/%s", path, buffer_ptr);
if ((status <= 0) || (status >= (int)sizeof(subpath)))
continue;