result->tv_sec = diff / 1000000;
result->tv_usec = diff % 1000000;
- return (diff < 0);
+ return diff < 0;
}
#endif /* COLLECT_DEBUG */
if (regcomp(®ex_direct, regexp_to_match, REG_EXTENDED)) {
ERROR("onewire plugin: Cannot compile regex");
direct_list_element_free(element);
- return (1);
+ return 1;
}
regex_direct_initialized = 1;
DEBUG("onewire plugin: Compiled regex!!");
if (ignorelist_add(sensor_list, value)) {
ERROR("onewire plugin: Cannot add value to ignorelist.");
- return (1);
+ return 1;
}
} else {
DEBUG("onewire plugin: %s is a direct access", value);
temp = strdup(value);
if (temp == NULL) {
ERROR("onewire plugin: strdup failed.");
- return (1);
+ return 1;
}
sfree(device_g);
device_g = temp;
else
ERROR("onewire plugin: Invalid `Interval' setting: %s", value);
} else {
- return (-1);
+ return -1;
}
- return (0);
+ return 0;
}
static int cow_read_values(const char *path, const char *name,
ERROR("onewire plugin: OW_get (%s/%s) failed. error = %s;", path,
family_info->features[i].filename,
sstrerror(errno, errbuf, sizeof(errbuf)));
- return (-1);
+ return -1;
}
DEBUG("Read onewire device %s as %s", file, buffer);
free(buffer);
} /* for (i = 0; i < features_num; i++) */
- return ((success > 0) ? 0 : -1);
+ return (success > 0) ? 0 : -1;
} /* int cow_read_values */
/* Forward declaration so the recursion below works */
char subpath[4096];
int status;
- status = ssnprintf(subpath, sizeof(subpath), "%s/main", path);
+ status = snprintf(subpath, sizeof(subpath), "%s/main", path);
if ((status > 0) && (status < (int)sizeof(subpath)))
cow_read_bus(subpath);
- status = ssnprintf(subpath, sizeof(subpath), "%s/aux", path);
+ status = snprintf(subpath, sizeof(subpath), "%s/aux", path);
if ((status > 0) && (status < (int)sizeof(subpath)))
cow_read_bus(subpath);
- return (0);
+ return 0;
} /* int cow_read_ds2409 */
static int cow_read_bus(const char *path) {
if (status < 0) {
ERROR("onewire plugin: OW_get (%s) failed. error = %s;", path,
sstrerror(errno, errbuf, sizeof(errbuf)));
- return (-1);
+ return -1;
}
DEBUG("onewire plugin: OW_get (%s) returned: %s", path, buffer);
dummy = NULL;
if (strcmp("/", path) == 0)
- status = ssnprintf(subpath, sizeof(subpath), "/%s", buffer_ptr);
+ status = snprintf(subpath, sizeof(subpath), "/%s", buffer_ptr);
else
- status = ssnprintf(subpath, sizeof(subpath), "%s/%s", path, buffer_ptr);
+ status = snprintf(subpath, sizeof(subpath), "%s/%s", path, buffer_ptr);
if ((status <= 0) || (status >= (int)sizeof(subpath)))
continue;
} /* while (strtok_r) */
free(buffer);
- return (0);
+ return 0;
} /* int cow_read_bus */
/* ===================================================================================
if (status < 0) {
ERROR("onewire plugin: OW_get (%s) failed. status = %s;", traverse->path,
sstrerror(errno, errbuf, sizeof(errbuf)));
- return (-1);
+ return -1;
}
DEBUG("onewire plugin: Read onewire device %s as %s", traverse->path,
buffer);
regfree(®ex_direct);
}
- return (0);
+ return 0;
} /* int cow_shutdown */
static int cow_init(void) {
if (device_g == NULL) {
ERROR("onewire plugin: cow_init: No device configured.");
- return (-1);
+ return -1;
}
DEBUG("onewire plugin: about to init device <%s>.", device_g);
if (status != 0) {
ERROR("onewire plugin: OW_init(%s) failed: %s.", device_g,
sstrerror(errno, errbuf, sizeof(errbuf)));
- return (1);
+ return 1;
}
plugin_register_complex_read(/* group = */ NULL, "onewire", cow_read,
ow_interval, /* user data = */ NULL);
plugin_register_shutdown("onewire", cow_shutdown);
- return (0);
+ return 0;
} /* int cow_init */
void module_register(void) {