X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fexec.c;h=88026b662a0be208daa58b24c418357a1c63399a;hb=a94f533;hp=6b6836e99d033723c75fefda49dd36b8242ea00a;hpb=c9cce919dd741a09986519b496cecaa7781f139e;p=collectd.git diff --git a/src/exec.c b/src/exec.c index 6b6836e9..88026b66 100644 --- a/src/exec.c +++ b/src/exec.c @@ -490,19 +490,22 @@ static int fork_child (program_list_t *pl, int *fd_in, int *fd_out, int *fd_err) static int parse_line (char *buffer) /* {{{ */ { - char *fields[256]; - int fields_num; - - fields[0] = "PUTVAL"; - fields_num = strsplit (buffer, fields + 1, STATIC_ARRAY_SIZE(fields) - 1); - - if (strcasecmp (fields[1], "putval") == 0) - return (handle_putval (stdout, fields + 1, fields_num)); + if (strncasecmp ("PUTVAL", buffer, strlen ("PUTVAL")) == 0) + return (handle_putval (stdout, buffer)); +#if !COLLECT_DEBUG +#error "TODO: PUTNOTIF" else if (strcasecmp (fields[1], "putnotif") == 0) return (handle_putnotif (stdout, fields + 1, fields_num)); - - /* compatibility code */ - return (handle_putval (stdout, fields, fields_num + 1)); +#endif + else + { + /* For backwards compatibility */ + char tmp[1220]; + /* Let's annoy the user a bit.. */ + INFO ("exec plugin: Prepending `PUTVAL' to this line: %s", buffer); + ssnprintf (tmp, sizeof (tmp), "PUTVAL %s", buffer); + return (handle_putval (stdout, tmp)); + } } /* int parse_line }}} */ static void *exec_read_one (void *arg) /* {{{ */ @@ -692,9 +695,9 @@ static void *exec_notification_one (void *arg) /* {{{ */ if (meta->type == NM_TYPE_STRING) fprintf (fh, "%s: %s\n", meta->name, meta->value_string); else if (meta->type == NM_TYPE_SIGNED_INT) - fprintf (fh, "%s: %lli\n", meta->name, meta->value_signed_int); + fprintf (fh, "%s: %"PRIi64"\n", meta->name, meta->value_signed_int); else if (meta->type == NM_TYPE_UNSIGNED_INT) - fprintf (fh, "%s: %llu\n", meta->name, meta->value_unsigned_int); + fprintf (fh, "%s: %"PRIu64"\n", meta->name, meta->value_unsigned_int); else if (meta->type == NM_TYPE_DOUBLE) fprintf (fh, "%s: %e\n", meta->name, meta->value_double); else if (meta->type == NM_TYPE_BOOLEAN)