X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcollectdctl.c;h=2329285371281e849e5bf82994111912201d2036;hb=79d834024d69d3b33e0fc4717b6560385b54cdd1;hp=53bd6184f75e8f57e9b0d847cc04e0db9109db0b;hpb=a92f88f0d5e0b0f6b80de5c569cd3d20a5572b95;p=collectd.git diff --git a/src/collectdctl.c b/src/collectdctl.c index 53bd6184..23292853 100644 --- a/src/collectdctl.c +++ b/src/collectdctl.c @@ -25,21 +25,47 @@ # include "config.h" #endif -#include "libcollectdclient/client.h" +#include +#include +#include +#include +#include #include - #include -#include - -#include - -#include -#include -#include - -#include +#if NAN_STATIC_DEFAULT +# include +/* #endif NAN_STATIC_DEFAULT*/ +#elif NAN_STATIC_ISOC +# ifndef __USE_ISOC99 +# define DISABLE_ISOC99 1 +# define __USE_ISOC99 1 +# endif /* !defined(__USE_ISOC99) */ +# include +# if DISABLE_ISOC99 +# undef DISABLE_ISOC99 +# undef __USE_ISOC99 +# endif /* DISABLE_ISOC99 */ +/* #endif NAN_STATIC_ISOC */ +#elif NAN_ZERO_ZERO +# include +# ifdef NAN +# undef NAN +# endif +# define NAN (0.0 / 0.0) +# ifndef isnan +# define isnan(f) ((f) != (f)) +# endif /* !defined(isnan) */ +# ifndef isfinite +# define isfinite(f) (((f) - (f)) == 0.0) +# endif +# ifndef isinf +# define isinf(f) (!isfinite(f) && !isnan(f)) +# endif +#endif /* NAN_ZERO_ZERO */ + +#include "libcollectdclient/collectd/client.h" #define DEFAULT_SOCK LOCALSTATEDIR"/run/"PACKAGE_NAME"-unixsock" @@ -73,7 +99,7 @@ static void exit_usage (const char *name, int status) { "No error is returned if the specified identifier does not exist.\n" "\n"PACKAGE" "VERSION", http://collectd.org/\n" - "by Florian octo Forster \n" + "by Florian octo Forster \n" "for contributions see `AUTHORS'\n" , name); exit (status); @@ -254,7 +280,7 @@ static int flush (lcc_connection_t *c, int argc, char **argv) } } else if (strcasecmp (key, "plugin") == 0) { - status = array_grow ((void **)&plugins, &plugins_num, + status = array_grow ((void *)&plugins, &plugins_num, sizeof (*plugins)); if (status != 0) BAIL_OUT (status); @@ -262,7 +288,7 @@ static int flush (lcc_connection_t *c, int argc, char **argv) plugins[plugins_num - 1] = value; } else if (strcasecmp (key, "identifier") == 0) { - status = array_grow ((void **)&identifiers, &identifiers_num, + status = array_grow ((void *)&identifiers, &identifiers_num, sizeof (*identifiers)); if (status != 0) BAIL_OUT (status); @@ -280,7 +306,7 @@ static int flush (lcc_connection_t *c, int argc, char **argv) } if (plugins_num == 0) { - status = array_grow ((void **)&plugins, &plugins_num, sizeof (*plugins)); + status = array_grow ((void *)&plugins, &plugins_num, sizeof (*plugins)); if (status != 0) BAIL_OUT (status); @@ -443,7 +469,7 @@ static int putval (lcc_connection_t *c, int argc, char **argv) vl.time = strtol (argv[i], &endptr, 0); - if (endptr == value) { + if (endptr == argv[i]) { fprintf (stderr, "ERROR: Failed to parse time as number: %s.\n", argv[i]); return (-1); @@ -459,7 +485,7 @@ static int putval (lcc_connection_t *c, int argc, char **argv) while (value != 0) { char *dot, *endptr; - tmp = strchr (argv[i], (int)':'); + tmp = strchr (value, (int)':'); if (tmp != NULL) { *tmp = '\0';