X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Frrd_graph_helper.c;h=595486a193388c91241b1e492610ed0bb308c8c5;hb=7e9d021d4b981dd1017e4e36617b5b60005582f3;hp=957087c0ff3ae3d3d6962c910cc86ce5e0c3c158;hpb=990fcfb7eec407edfe504f42760bae204e1c074d;p=rrdtool.git diff --git a/src/rrd_graph_helper.c b/src/rrd_graph_helper.c index 957087c..595486a 100644 --- a/src/rrd_graph_helper.c +++ b/src/rrd_graph_helper.c @@ -1,5 +1,5 @@ /**************************************************************************** - * RRDtool 1.2rc9 Copyright by Tobi Oetiker, 1997-2005 + * RRDtool 1.2.1 Copyright by Tobi Oetiker, 1997-2005 **************************************************************************** * rrd_graph_helper.c commandline parser functions * this code initially written by Alex van den Bogaerdt @@ -34,7 +34,7 @@ int rrd_parse_cdef (char *, unsigned int *, graph_desc_t *, image_desc_t *); int rrd_parse_find_gf(char *line, unsigned int *eaten, graph_desc_t *gdp) { - char funcname[11],c1=0,c2=0; + char funcname[11],c1=0; int i=0; sscanf(&line[*eaten], "DEBUG%n", &i); @@ -44,7 +44,7 @@ rrd_parse_find_gf(char *line, unsigned int *eaten, graph_desc_t *gdp) { i=0; dprintf("Scanning line '%s'\n",&line[*eaten]); } - sscanf(&line[*eaten], "%10[A-Z]%n%c%c", funcname, &i, &c1, &c2); + sscanf(&line[*eaten], "%10[A-Z]%n%c", funcname, &i, &c1); if (!i) { rrd_set_error("Could not make sense out of '%s'",line); return 1; @@ -54,12 +54,22 @@ rrd_parse_find_gf(char *line, unsigned int *eaten, graph_desc_t *gdp) { return 1; } if (gdp->gf == GF_LINE) { - if (c1 < '1' || c1 > '3' || c2 != ':') { - rrd_set_error("Malformed LINE command: %s",line); - return 1; + if (c1 == ':'){ + gdp->linewidth=1; + } else { + double width; + *eaten+=i; + if (sscanf(&line[*eaten],"%lf%n:",&width,&i)){ + if (width < 0 || isnan(width) || isinf(width) ){ + rrd_set_error("LINE width is %lf. It must be finite and >= 0 though",width); + return 1; + } + gdp->linewidth=width; + } else { + rrd_set_error("LINE width: %s",line); + return 1; + } } - gdp->linewidth=c1-'0'; - i++; } else { if (c1 != ':') { rrd_set_error("Malformed %s command: %s",funcname,line);