empty columns. The plugin uses the L<strtok_r(3)> function to parse the lines
of a table - see its documentation for more details. This option is mandatory.
+A horizontal tab, newline and carriage return may be specified by C<\\t>,
+C<\\n> and C<\\r> respectively. Please note that the double backslashes are
+required because of collectd's config parsing.
+
=back
The following options are available inside a B<Result> block:
return (ret);
} /* int strsubstitute */
+int strunescape (char *buf, size_t buf_len)
+{
+ size_t i;
+
+ for (i = 0; (i < buf_len) && (buf[i] != '\0'); ++i)
+ {
+ if (buf[i] != '\\')
+ continue;
+
+ if ((i >= buf_len) || (buf[i + 1] == '\0')) {
+ ERROR ("string unescape: backslash found at end of string.");
+ return (-1);
+ }
+
+ switch (buf[i + 1]) {
+ case 't':
+ buf[i] = '\t';
+ break;
+ case 'n':
+ buf[i] = '\n';
+ break;
+ case 'r':
+ buf[i] = '\r';
+ break;
+ default:
+ buf[i] = buf[i + 1];
+ break;
+ }
+
+ memmove (buf + i + 1, buf + i + 2, buf_len - i - 2);
+ }
+ return (0);
+} /* int strunescape */
+
int escape_slashes (char *buf, int buf_len)
{
int i;
/*
* NAME
+ * strunescape
+ *
+ * DESCRIPTION
+ * Replaces any escaped characters in a string with the appropriate special
+ * characters. The following escaped characters are recognized:
+ *
+ * \t -> <tab>
+ * \n -> <newline>
+ * \r -> <carriage return>
+ *
+ * For all other escacped characters only the backslash will be removed.
+ *
+ * PARAMETERS
+ * `buf' String to be unescaped.
+ * `buf_len' Length of the string, including the terminating null-byte.
+ *
+ * RETURN VALUE
+ * Returns zero upon success, a value less than zero else.
+ */
+int strunescape (char *buf, size_t buf_len);
+
+/*
+ * NAME
* timeval_cmp
*
* DESCRIPTION
log_err ("Table \"%s\" does not specify any separator.", tbl->file);
status = 1;
}
+ strunescape (tbl->sep, strlen (tbl->sep) + 1);
if (NULL == tbl->instance) {
tbl->instance = sstrdup (tbl->file);