X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fprotocols.c;h=0dfba2101fa578e92c56c360b795f1e989ff1a29;hb=aff80830f1154a5b6c4da16a0b1033aafde14e24;hp=75e9a1c4782035bbeffcbfc232a9fcb5d3936512;hpb=d37ebe6eb6dd2bbf8213a924dfbce6e91945aab8;p=collectd.git diff --git a/src/protocols.c b/src/protocols.c index 75e9a1c4..0dfba210 100644 --- a/src/protocols.c +++ b/src/protocols.c @@ -1,6 +1,6 @@ /** * collectd - src/protocols.c - * Copyright (C) 2009 Florian octo Forster + * Copyright (C) 2009,2010 Florian octo Forster * * 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 @@ -51,14 +51,10 @@ static void submit (const char *protocol_name, { value_t values[1]; value_list_t vl = VALUE_LIST_INIT; + int status; - char *tmp_ptr; - - errno = 0; - tmp_ptr = NULL; - values[0].counter = (counter_t) strtoll (str_value, &tmp_ptr, - /* base = */ 0); - if ((errno != 0) || (tmp_ptr == str_value)) + status = parse_value (str_value, values, DS_TYPE_DERIVE); + if (status != 0) { ERROR ("protocols plugin: Parsing string as integer failed: %s", str_value); @@ -166,7 +162,7 @@ static int read_file (const char *path) if (key_fields_num != value_fields_num) { ERROR ("protocols plugin: Number of fields in keys and values lines " - "dont match: %i vs %i.", + "don't match: %i vs %i.", key_fields_num, value_fields_num); break; } @@ -224,9 +220,7 @@ static int protocols_config (const char *key, const char *value) else if (strcasecmp (key, "IgnoreSelected") == 0) { int invert = 1; - if ((strcasecmp (value, "True") == 0) - || (strcasecmp (value, "Yes") == 0) - || (strcasecmp (value, "On") == 0)) + if (IS_TRUE (value)) invert = 0; ignorelist_set_invert (values_list, invert); }