index 29bcb5d6122926b0a4df83325305ad7957d9f327..32930584b6ef06d42c3a79dbb04a6c31371e7c64 100644 (file)
+/****************************************************************************
+ * RRDtool 1.2rc2 Copyright by Tobi Oetiker, 1997-2005
+ ****************************************************************************
+ * rrd_graph_helper.c commandline parser functions
+ * this code was probably writtenn by Alex van den Bogaerdt
+ ****************************************************************************/
+
#include "rrd_graph.h"
#define dprintf if (gdp->debug) printf
@@ -156,10 +163,10 @@ rrd_parse_print(char *line, unsigned int *eaten, graph_desc_t *gdp, image_desc_t
}
if (rrd_parse_legend(line,eaten,gdp)) return 1;
-
- /* Why is there a separate structure member "format" ??? */
+ /* for *PRINT the legend itself gets renderd later. We only
+ get the format at this juncture */
strcpy(gdp->format,gdp->legend);
-
+ gdp->legend[0]='\0';
return 0;
}
@@ -168,7 +175,7 @@ rrd_parse_shift(char *line, unsigned int *eaten, graph_desc_t *gdp, image_desc_t
char *l = strdup(line + *eaten), *p;
int rc = 1;
- p = strchr(l, ',');
+ p = strchr(l, ':');
if (p == NULL) {
rrd_set_error("Invalid SHIFT syntax");
goto out;
@@ -325,13 +332,24 @@ rrd_parse_PVHLAST(char *line, unsigned int *eaten, graph_desc_t *gdp, image_desc
}
dprintf("- looking for optional legend\n");
dprintf("- in '%s'\n",&line[*eaten]);
+ /* the legend for a graph item must start with "m " the first
+ m will then be over drawn with a color box. Since there
+ is ample space I overwrite the first few characters of the line
+ with the material that I want to see in the legend */
+ if (line[*eaten] != '\0' && line[*eaten] != ':'){
+ *eaten = *eaten - 2;
+ line[*eaten] = 'm';
+ line[*eaten+1] = ' ';
+ }
if (rrd_parse_legend(line, eaten, gdp)) return 1;
}
/* PART, HRULE, VRULE and TICK cannot be stacked. We're finished */
if ( (gdp->gf == GF_HRULE)
|| (gdp->gf == GF_VRULE)
+#ifdef WITH_PIECHART
|| (gdp->gf == GF_PART)
+#endif
|| (gdp->gf == GF_TICK)
) return 0;
@@ -352,7 +370,6 @@ rrd_parse_PVHLAST(char *line, unsigned int *eaten, graph_desc_t *gdp, image_desc
return 1;
}
}
-
return 0;
}
case GF_COMMENT: /* text */
if (rrd_parse_legend(argv[i],&eaten,gdp)) return;
break;
+#ifdef WITH_PIECHART
case GF_PART: /* value[#color[:legend]] */
+#endif
case GF_VRULE: /* value#color[:legend] */
case GF_HRULE: /* value#color[:legend] */
case GF_LINE: /* vname-or-value[#color[:legend]][:STACK] */