summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dc45c37)
raw | patch | inline | side by side (parent: dc45c37)
author | Florian Forster <ff@octo.it> | |
Mon, 21 Jun 2010 10:30:28 +0000 (12:30 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 21 Jun 2010 10:30:28 +0000 (12:30 +0200) |
src/graph.c | patch | blob | history | |
src/graph.h | patch | blob | history |
diff --git a/src/graph.c b/src/graph.c
index a503bfe1e3c3fcb5c8d353e2a4a54891c770feeb..6b898595f36ed703bc3854b3df34a2dcf25ac6d2 100644 (file)
--- a/src/graph.c
+++ b/src/graph.c
return (0);
} /* }}} int graph_get_title */
+int graph_get_params (graph_config_t *cfg, /* {{{ */
+ char *buffer, size_t buffer_size)
+{
+ buffer[0] = 0;
+
+#define COPY_FIELD(field) do { \
+ const char *str = ident_get_##field (cfg->select); \
+ char uri_str[1024]; \
+ uri_escape (uri_str, str, sizeof (uri_str)); \
+ strlcat (buffer, #field, buffer_size); \
+ strlcat (buffer, "=", buffer_size); \
+ strlcat (buffer, uri_str, buffer_size); \
+} while (0)
+
+ COPY_FIELD(host);
+ strlcat (buffer, ";", buffer_size);
+ COPY_FIELD(plugin);
+ strlcat (buffer, ";", buffer_size);
+ COPY_FIELD(plugin_instance);
+ strlcat (buffer, ";", buffer_size);
+ COPY_FIELD(type);
+ strlcat (buffer, ";", buffer_size);
+ COPY_FIELD(type_instance);
+
+#undef COPY_FIELD
+
+ return (0);
+} /* }}} int graph_get_params */
+
graph_ident_t *graph_get_selector (graph_config_t *cfg) /* {{{ */
{
if (cfg == NULL)
diff --git a/src/graph.h b/src/graph.h
index 98014c556b94f917e0030f1add1f4a9116c6340c..7f1115ce6215e7d9501f2dfdb712fc59ed8543da 100644 (file)
--- a/src/graph.h
+++ b/src/graph.h
int graph_get_title (graph_config_t *cfg,
char *buffer, size_t buffer_size);
+int graph_get_params (graph_config_t *cfg, char *buffer, size_t buffer_size);
+
graph_ident_t *graph_get_selector (graph_config_t *cfg);
graph_instance_t *graph_get_instances (graph_config_t *cfg);