X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Frrd_graph_helper.c;h=ec06d7789fd8115215551c2eb42ee4ba3d092ae0;hb=0a82736faf62f1667434aee71e51d876d20c6ced;hp=2e807419315d39f60767a779b5b4eda27e756569;hpb=0dc5d6d50c0d95ba4f04b656358b26518d4ce854;p=rrdtool.git diff --git a/src/rrd_graph_helper.c b/src/rrd_graph_helper.c index 2e80741..ec06d77 100644 --- a/src/rrd_graph_helper.c +++ b/src/rrd_graph_helper.c @@ -1,5 +1,5 @@ /**************************************************************************** - * RRDtool 1.2.9 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 @@ -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;