X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Frrd_graph_helper.c;h=d59625b98004706dd06a4b8ff6e72b6d22aca9cc;hb=2593a69e9485cf67c9654a2667f85971275004fe;hp=fb72b16a0613d811cf6877f348556c647d92e4bb;hpb=65878d5b2342b37186d9557f314e8a37dbc86de2;p=rrdtool.git diff --git a/src/rrd_graph_helper.c b/src/rrd_graph_helper.c index fb72b16..d59625b 100644 --- a/src/rrd_graph_helper.c +++ b/src/rrd_graph_helper.c @@ -62,7 +62,7 @@ int rrd_parse_color( const char *const, graph_desc_t *const); -int rrd_parse_textalign( +int rrd_parse_textalign( const char *const, unsigned int *const, graph_desc_t *const); @@ -445,9 +445,12 @@ int rrd_parse_shift( return 1; } } else { + long time_tmp = 0; + rrd_clear_error(); i = 0; - sscanf(&line[*eaten], "%li%n", &gdp->shval, &i); + sscanf(&line[*eaten], "%li%n", &time_tmp, &i); + gdp->shval = time_tmp; if (i != (int) strlen(&line[*eaten])) { rrd_set_error("Not a valid offset: %s in line %s", &line[*eaten], line); @@ -496,17 +499,14 @@ int rrd_parse_textalign( unsigned int *const eaten, graph_desc_t *const gdp) { - if (strcmp(&line[*eaten],"left")==0){ - gdp->txtalign=TXA_LEFT; - } - else if (strcmp(&line[*eaten],"right")==0){ - gdp->txtalign=TXA_RIGHT; - } - else if (strcmp(&line[*eaten],"justified")==0){ - gdp->txtalign=TXA_JUSTIFIED; - } - else if (strcmp(&line[*eaten],"center")==0){ - gdp->txtalign=TXA_CENTER; + if (strcmp(&line[*eaten], "left") == 0) { + gdp->txtalign = TXA_LEFT; + } else if (strcmp(&line[*eaten], "right") == 0) { + gdp->txtalign = TXA_RIGHT; + } else if (strcmp(&line[*eaten], "justified") == 0) { + gdp->txtalign = TXA_JUSTIFIED; + } else if (strcmp(&line[*eaten], "center") == 0) { + gdp->txtalign = TXA_CENTER; } else { rrd_set_error("Unknown alignement type '%s'", &line[*eaten]); return 1; @@ -597,9 +597,6 @@ int rrd_parse_PVHLAST( if ((gdp->vidx = find_var(im, tmpstr)) >= 0) { dprintf("- found vname: '%s' vidx %li\n", tmpstr, gdp->vidx); switch (gdp->gf) { -#ifdef WITH_PIECHART - case GF_PART: -#endif case GF_VRULE: case GF_HRULE: if (im->gdes[gdp->vidx].gf != GF_VDEF) { @@ -611,11 +608,14 @@ int rrd_parse_PVHLAST( default:; } } else { + long time_tmp = 0; + dprintf("- it is not an existing vname\n"); switch (gdp->gf) { case GF_VRULE: k = 0; - sscanf(tmpstr, "%li%n", &gdp->xrule, &k); + sscanf(tmpstr, "%li%n", &time_tmp, &k); + gdp->xrule = time_tmp; if (((j != 0) && (k == j)) || ((j == 0) && (k == i))) { dprintf("- found time: %li\n", gdp->xrule); } else { @@ -629,9 +629,9 @@ int rrd_parse_PVHLAST( k = 0; sscanf(tmpstr, "%lf%n", &gdp->yrule, &k); if (((j != 0) && (k == j)) || ((j == 0) && (k == i))) { - dprintf("- found number: %f\n", gdp->yrule); + dprintf("- found number: %lf\n", gdp->yrule); } else { - dprintf("- is is not a valid number: %li\n", gdp->xrule); + dprintf("- is is not a valid number: %lf\n", gdp->yrule); rrd_set_error ("parameter '%s' does not represent a number in line %s\n", tmpstr, line);