summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 75a0b12)
raw | patch | inline | side by side (parent: 75a0b12)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Fri, 6 Aug 2010 12:59:56 +0000 (14:59 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Fri, 6 Aug 2010 13:02:29 +0000 (15:02 +0200) |
src/utils_cmd_putval.c | patch | blob | history | |
src/utils_cmd_putval.h | patch | blob | history |
diff --git a/src/utils_cmd_putval.c b/src/utils_cmd_putval.c
index ec2b5f876795b53f2faec5c5ddc6104d7c0679a3..15cd939b00610b68215d8b54143e435d50530c8a 100644 (file)
--- a/src/utils_cmd_putval.c
+++ b/src/utils_cmd_putval.c
return (0);
} /* int handle_putval */
+int create_putval (char *ret, size_t ret_len, /* {{{ */
+ const data_set_t *ds, const value_list_t *vl)
+{
+ char buffer_ident[6 * DATA_MAX_NAME_LEN];
+ char buffer_values[1024];
+ int status;
+
+ status = FORMAT_VL (buffer_ident, sizeof (buffer_ident), vl);
+ if (status != 0)
+ return (status);
+ escape_string (buffer_ident, sizeof (buffer_ident));
+
+ status = format_values (buffer_values, sizeof (buffer_values),
+ ds, vl, /* store rates = */ 0);
+ if (status != 0)
+ return (status);
+ escape_string (buffer_values, sizeof (buffer_values));
+
+ ssnprintf (ret, ret_len,
+ "PUTVAL %s interval=%i %s",
+ buffer_ident,
+ (vl->interval > 0) ? vl->interval : interval_g,
+ buffer_values);
+
+ return (0);
+} /* }}} int create_putval */
diff --git a/src/utils_cmd_putval.h b/src/utils_cmd_putval.h
index 8460b13388488be5c1401a3ff23a57a3d6e4f4bb..9c92fd31c0caf6a0524ef595c60d3158051b73aa 100644 (file)
--- a/src/utils_cmd_putval.h
+++ b/src/utils_cmd_putval.h
#include <stdio.h>
+#include "plugin.h"
+
int handle_putval (FILE *fh, char *buffer);
+int create_putval (char *ret, size_t ret_len,
+ const data_set_t *ds, const value_list_t *vl);
+
#endif /* UTILS_CMD_PUTVAL_H */