X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Frrd_graph_helper.c;h=08f74d1ff5e84034516584543eafe76609b97f8e;hb=b19eb0bf096c125f806a49eff07c6634e8b035d5;hp=0fb464d57c2647c607969a37666728fef52dd09a;hpb=96db36a7a6ff75d2fc1353e45434a7f6b1db801b;p=rrdtool.git diff --git a/src/rrd_graph_helper.c b/src/rrd_graph_helper.c index 0fb464d..08f74d1 100644 --- a/src/rrd_graph_helper.c +++ b/src/rrd_graph_helper.c @@ -1,5 +1,5 @@ /**************************************************************************** - * RRDtool 1.2.7 Copyright by Tobi Oetiker, 1997-2005 + * RRDtool 1.2.11 Copyright by Tobi Oetiker, 1997-2005 **************************************************************************** * rrd_graph_helper.c commandline parser functions * this code initially written by Alex van den Bogaerdt @@ -119,7 +119,7 @@ rrd_parse_color(char *string, graph_desc_t *gdp) { */ i=0; - while (string[i] && isxdigit(string[i])) i++; + while (string[i] && isxdigit((unsigned int)string[i])) i++; if (string[i] != '\0') return 1; /* garbage follows hexdigits */ switch (i) { case 3: @@ -330,16 +330,28 @@ rrd_parse_PVHLAST(char *line, unsigned int *eaten, graph_desc_t *gdp, image_desc tmpstr[j]='\0'; } + /* Number or vname ? + * It is a number only if "k" equals either "j" or "i", + * depending on which is appropriate + */ dprintf("- examining value '%s'\n",tmpstr); k=0; if (gdp->gf == GF_VRULE) { sscanf(tmpstr,"%li%n",&gdp->xrule,&k); - if (k) dprintf("- found time: %li\n",gdp->xrule); + if (((j!=0)&&(k==j))||((j==0)&&(k==i))) { + dprintf("- found time: %li\n",gdp->xrule); + } else { + gdp->xrule=0; /* reset the value to "none" */ + } } else { sscanf(tmpstr,"%lf%n",&gdp->yrule,&k); - if (k) dprintf("- found number: %f\n",gdp->yrule); + if (((j!=0)&&(k==j))||((j==0)&&(k==i))) { + dprintf("- found number: %f\n",gdp->yrule); + } else { + gdp->yrule=DNAN; /* reset the value to "none" */ + } } - if (!k) { + if (((j!=0)&&(k!=j))||((j==0)&&(k!=i))) { if ((gdp->vidx=find_var(im,tmpstr))<0) { rrd_set_error("Not a valid vname: %s in line %s",tmpstr,line); return 1; @@ -556,6 +568,7 @@ rrd_parse_def(char *line, unsigned int *eaten, graph_desc_t *gdp, image_desc_t * } else if (!strcmp("step",command)) { i=0; sscanf(&line[*eaten],"%lu%n",&gdp->step,&i); + gdp->step_orig = gdp->step; (*eaten)+=i; dprintf("- using step %lu\n",gdp->step); } else if (!strcmp("start",command)) { @@ -605,6 +618,8 @@ rrd_parse_def(char *line, unsigned int *eaten, graph_desc_t *gdp, image_desc_t * gdp->start = start_tmp; gdp->end = end_tmp; + gdp->start_orig = start_tmp; + gdp->end_orig = end_tmp; dprintf("- start time %lu\n",gdp->start); dprintf("- end time %lu\n",gdp->end);