X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Frrd_graph_helper.c;h=e7ec902292ac95ebc30aa1e7f5211caccb0cf464;hb=d9822df7ed5e8122cf3a62e4e99678e94007f504;hp=d570e58a365db31b85662dc7ac4aef891e8db582;hpb=33df5c014df769dddc6df97bb7071ad1afb3e4eb;p=pkg-rrdtool.git diff --git a/src/rrd_graph_helper.c b/src/rrd_graph_helper.c index d570e58..e7ec902 100644 --- a/src/rrd_graph_helper.c +++ b/src/rrd_graph_helper.c @@ -1,5 +1,5 @@ /**************************************************************************** - * RRDtool 1.3.1 Copyright by Tobi Oetiker, 1997-2008 + * RRDtool 1.4.8 Copyright by Tobi Oetiker, 1997-2013 **************************************************************************** * rrd_graph_helper.c commandline parser functions * this code initially written by Alex van den Bogaerdt @@ -516,10 +516,10 @@ int rrd_parse_textalign( } -/* Parsing of PART, VRULE, HRULE, LINE, AREA, STACK and TICK +/* Parsing of VRULE, HRULE, LINE, AREA, STACK and TICK ** is done in one function. ** -** Stacking PART, VRULE, HRULE or TICK is not allowed. +** Stacking VRULE, HRULE or TICK is not allowed. ** ** If a number (which is valid to enter) is more than a ** certain amount of characters, it is caught as an error. @@ -541,18 +541,12 @@ int rrd_parse_PVHLAST( float one_space = gfx_get_text_width(im, 0, im-> text_prop[TEXT_PROP_LEGEND]. - font, - im-> - text_prop[TEXT_PROP_LEGEND]. - size, + font_desc, im->tabwidth, " ") / 4.0; float target_space = gfx_get_text_width(im, 0, im-> text_prop - [TEXT_PROP_LEGEND].font, - im-> - text_prop - [TEXT_PROP_LEGEND].size, + [TEXT_PROP_LEGEND].font_desc, im->tabwidth, "oo"); spacecnt = target_space / one_space; @@ -739,7 +733,7 @@ int rrd_parse_PVHLAST( } (*eaten)++; /* after colon */ - /* PART, HRULE, VRULE and TICK cannot be stacked. */ + /* HRULE, VRULE and TICK cannot be stacked. */ if ((gdp->gf != GF_HRULE) && (gdp->gf != GF_VRULE) && (gdp->gf != GF_TICK)) { @@ -764,6 +758,24 @@ int rrd_parse_PVHLAST( dprintf("- not STACKing\n"); } + dprintf("- parsing '%s', looking for skipscale\n", &line[*eaten]); + j = scan_for_col(&line[*eaten], 9, tmpstr); + if (!strcmp("skipscale", tmpstr)) { + dprintf("- found skipscale\n"); + gdp->skipscale = 1; + (*eaten) += j; + if (line[*eaten] == ':') { + (*eaten) += 1; + } else if (line[*eaten] == '\0') { + dprintf("- done parsing line\n"); + return 0; + } else { + dprintf("- found %s instead of just skipscale\n", &line[*eaten]); + rrd_set_error("skipscale expected but %s found", &line[*eaten]); + return 1; + } + } + dprintf("- still more, should be dashes[=...]\n"); dprintf("- parsing '%s'\n", &line[*eaten]); if (line[*eaten] != '\0') { @@ -868,6 +880,10 @@ int rrd_parse_make_vname( rrd_set_error("Cannot parse vname from '%s'", line); return 1; } + if (line[*eaten+i] == '\0') { + rrd_set_error("String ends after the = sign on '%s'", line); + return 1; + } dprintf("- found candidate '%s'\n", tmpstr); if ((gdp->vidx = find_var(im, tmpstr)) >= 0) { @@ -1078,7 +1094,7 @@ void rrd_graph_script( graph_desc_t *gdp; unsigned int eaten = 0; - if (gdes_alloc(im)) + if (gdes_alloc(im)) /* gdes_c ++ */ return; /* the error string is already set */ gdp = &im->gdes[im->gdes_c - 1]; #ifdef DEBUG @@ -1159,5 +1175,13 @@ void rrd_graph_script( &argv[i][eaten], argv[i]); return; } + char *key = gdes_fetch_key((*gdp)); + if (gdp->gf == GF_DEF && !g_hash_table_lookup_extended(im->rrd_map,key,NULL,NULL)){ + g_hash_table_insert(im->gdef_map,g_strdup(key),GINT_TO_POINTER(im->gdes_c-1)); + } + free(key); + if (gdp->gf == GF_DEF || gdp->gf == GF_VDEF || gdp->gf == GF_CDEF){ + g_hash_table_insert(im->gdef_map,g_strdup(gdp->vname),GINT_TO_POINTER(im->gdes_c-1)); + } } }