X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Flibcollectdclient%2Fclient.c;h=abe3ed83aa469b4cf148504cd9f73403da3bad50;hb=6624c959628fa1188f8cfa4789da1eccccc5f5e4;hp=0c748ba7fa47e3b30f1d2a8d5c30dffdfd70d3e3;hpb=37e18082cfb22491138e282074c5267df48dd8de;p=collectd.git diff --git a/src/libcollectdclient/client.c b/src/libcollectdclient/client.c index 0c748ba7..abe3ed83 100644 --- a/src/libcollectdclient/client.c +++ b/src/libcollectdclient/client.c @@ -27,7 +27,7 @@ # define __attribute__(x) /**/ #endif -#include "lcc_features.h" +#include "collectd/lcc_features.h" #include #include @@ -41,7 +41,7 @@ #include #include -#include "client.h" +#include "collectd/client.h" /* NI_MAXHOST has been obsoleted by RFC 3493 which is a reason for SunOS 5.11 * to no longer define it. We'll use the old, RFC 2553 value here. */ @@ -788,7 +788,7 @@ int lcc_putval (lcc_connection_t *c, const lcc_value_list_t *vl) /* {{{ */ else if (vl->values_types[i] == LCC_TYPE_GAUGE) { if (isnan (vl->values[i].gauge)) - SSTRCPY (command, ":U"); + SSTRCATF (command, ":U"); else SSTRCATF (command, ":%g", vl->values[i].gauge); } @@ -1069,4 +1069,33 @@ int lcc_string_to_identifier (lcc_connection_t *c, /* {{{ */ return (0); } /* }}} int lcc_string_to_identifier */ +int lcc_identifier_compare (const lcc_identifier_t *i0, /* {{{ */ + const lcc_identifier_t *i1) +{ + int status; + + if ((i0 == NULL) && (i1 == NULL)) + return (0); + else if (i0 == NULL) + return (-1); + else if (i1 == NULL) + return (1); + +#define CMP_FIELD(f) do { \ + status = strcmp (i0->f, i1->f); \ + if (status != 0) \ + return (status); \ +} while (0); + + CMP_FIELD (host); + CMP_FIELD (plugin); + CMP_FIELD (plugin_instance); + CMP_FIELD (type); + CMP_FIELD (type_instance); + +#undef CMP_FIELD + + return (0); +} /* }}} int lcc_identifier_compare */ + /* vim: set sw=2 sts=2 et fdm=marker : */