/**
* collectd - src/sensors.c
- * Copyright (C) 2005-2007 Florian octo Forster
+ * Copyright (C) 2005-2008 Florian octo Forster
+ * Copyright (C) 2006 Luboš Staněk
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
if (chip->bus == SENSORS_CHIP_NAME_BUS_ISA)
{
- status = snprintf (buf, buf_size,
+ status = ssnprintf (buf, buf_size,
"%s-isa-%04x",
chip->prefix,
chip->addr);
else if (strcasecmp (key, "IgnoreSelected") == 0)
{
ignorelist_set_invert (sensor_list, 1);
- if ((strcasecmp (value, "True") == 0)
- || (strcasecmp (value, "Yes") == 0)
- || (strcasecmp (value, "On") == 0))
+ if (IS_TRUE (value))
ignorelist_set_invert (sensor_list, 0);
}
else
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
- status = snprintf (match_key, sizeof (match_key), "%s/%s-%s",
+ status = ssnprintf (match_key, sizeof (match_key), "%s/%s-%s",
plugin_instance, type, type_instance);
if (status < 1)
return;
- match_key[sizeof (match_key) - 1] = '\0';
if (sensor_list != NULL)
{
vl.values = values;
vl.values_len = 1;
- vl.time = time (NULL);
- strncpy (vl.host, hostname_g, sizeof (vl.host));
- vl.host[sizeof (vl.host) - 1] = '\0';
- strncpy (vl.plugin, "sensors", sizeof (vl.plugin));
- vl.plugin[sizeof (vl.plugin) - 1] = '\0';
- strncpy (vl.plugin_instance, plugin_instance,
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "sensors", sizeof (vl.plugin));
+ sstrncpy (vl.plugin_instance, plugin_instance,
sizeof (vl.plugin_instance));
- vl.plugin_instance[sizeof (vl.plugin_instance) - 1] = '\0';
- strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
- vl.type_instance[sizeof (vl.type_instance) - 1] = '\0';
+ sstrncpy (vl.type, type, sizeof (vl.type));
+ sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
} /* void sensors_submit */
static int sensors_read (void)
sizeof (plugin_instance), fl->chip);
if (status < 0)
continue;
- plugin_instance[sizeof (plugin_instance) - 1] = '\0';
- strncpy (type_instance, fl->data->name,
+ sstrncpy (type_instance, fl->data->name,
sizeof (type_instance));
- type_instance[sizeof (type_instance) - 1] = '\0';
sensors_submit (plugin_instance,
sensor_type_name_map[fl->type],
sizeof (plugin_instance), fl->chip);
if (status < 0)
continue;
- plugin_instance[sizeof (plugin_instance) - 1] = '\0';
- strncpy (type_instance, fl->feature->name,
+ sstrncpy (type_instance, fl->feature->name,
sizeof (type_instance));
- type_instance[sizeof (type_instance) - 1] = '\0';
if (fl->feature->type == SENSORS_FEATURE_IN)
type = "voltage";