index b464007d8a09f9ef5104f4248391fd21fa4ae26f..e857df85be69e08f4294437a6d33554b45ccdfbc 100644 (file)
/****************************************************************************
- * RRDtool 1.2.2 Copyright by Tobi Oetiker, 1997-2005
+ * RRDtool 1.2.4 Copyright by Tobi Oetiker, 1997-2005
****************************************************************************
* rrd_graph_helper.c commandline parser functions
* this code initially written by Alex van den Bogaerdt
@@ -298,6 +298,11 @@ rrd_parse_PVHLAST(char *line, unsigned int *eaten, graph_desc_t *gdp, image_desc
dprintf("- parsing '%s'\n",&line[*eaten]);
+ /* have simpler code in the drawing section */
+ if ( gdp->gf == GF_STACK ){
+ gdp->stack=1;
+ }
+
i=scan_for_col(&line[*eaten],MAX_VNAME_LEN+9,tmpstr);
if (line[*eaten+i]!='\0' && line[*eaten+i]!=':') {
rrd_set_error("Cannot parse line '%s'",line);
@@ -388,20 +393,19 @@ rrd_parse_PVHLAST(char *line, unsigned int *eaten, graph_desc_t *gdp, image_desc
** LINE:val::STACK means no legend, and do STACK
*/
if (colorfound) {
- char c1,c2;
int err=0;
char *linecp = strdup(line);
dprintf("- looking for optional legend\n");
-
- /* The legend needs to be prefixed with "m ". This then gets
- ** replaced by the color box. */
-
+
dprintf("- examining '%s'\n",&line[*eaten]);
-
- (*eaten)--;
- linecp[*eaten]=' ';
- (*eaten)--;
- linecp[*eaten]='m';
+ if (linecp[*eaten] != '\0' && linecp[*eaten] != ':') {
+ /* If the legend is not empty, it has to be prefixed with "m ". This then gets
+ * replaced by the color box later on. */
+ (*eaten)--;
+ linecp[*eaten]='o';
+ (*eaten)--;
+ linecp[*eaten]='o';
+ }
if (rrd_parse_legend(linecp, eaten, gdp)) err=1;
@@ -456,10 +460,6 @@ rrd_parse_PVHLAST(char *line, unsigned int *eaten, graph_desc_t *gdp, image_desc
(*eaten)++;
dprintf("- parsing '%s'\n",&line[*eaten]);
- /* have simpler code in the drawing section */
- if ( gdp->gf == GF_STACK ){
- gdp->stack=1;
- }
return 0;
}