summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b57ecd4)
raw | patch | inline | side by side (parent: b57ecd4)
author | Florian Forster <ff@octo.it> | |
Wed, 14 Jul 2010 15:01:33 +0000 (17:01 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Wed, 14 Jul 2010 15:01:33 +0000 (17:01 +0200) |
… if no legend has been specified. Using the DS name here isn't as good
since often many files of the same type are grouped together.
since often many files of the same type are grouped together.
src/graph_def.c | patch | blob | history |
diff --git a/src/graph_def.c b/src/graph_def.c
index bcef8cfda810320569b2e4e959cf55632535eac2..1f78dddf90e16c79f3f3785d8774d9a3f80c5e81 100644 (file)
--- a/src/graph_def.c
+++ b/src/graph_def.c
char *file;
int index;
char draw_def[64];
+ char legend[256];
if ((def == NULL) || (ident == NULL) || (args == NULL))
return (EINVAL);
DEBUG ("gl_ident_get_rrdargs: file = %s;\n", file);
+ if (def->legend != NULL)
+ {
+ strncpy (legend, def->legend, sizeof (legend));
+ legend[sizeof (legend) - 1] = 0;
+ }
+ else
+ {
+ ident_describe (ident, def->select,
+ legend, sizeof (legend));
+
+ if ((legend[0] == 0) || (strcmp ("default", legend) == 0))
+ {
+ strncpy (legend, def->ds_name, sizeof (legend));
+ legend[sizeof (legend) - 1] = 0;
+ }
+ }
+
index = args->index;
args->index++;
array_prepend_format (args->lines, "GPRINT:vdef_%04i_min:%s min,",
index, (def->format != NULL) ? def->format : "%6.2lf");
array_prepend_format (args->lines, "LINE1:%s#%06"PRIx32":%s",
- draw_def, def->color,
- (def->legend != NULL) ? def->legend : def->ds_name);
+ draw_def, def->color, legend);
free (file);