X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_graph_helper.c;h=20198edd97a57b623aa033559383f7e993443029;hb=ec2afe5e94d9fcd72bb58e572f0251c7557325f7;hp=8855dcd1a5069de18f1c6dc7156699cd10ee0ca6;hpb=0043267aa80eec6dbb4e406b52585c974f176a2f;p=rrdtool.git diff --git a/src/rrd_graph_helper.c b/src/rrd_graph_helper.c index 8855dcd..20198ed 100644 --- a/src/rrd_graph_helper.c +++ b/src/rrd_graph_helper.c @@ -1,5 +1,5 @@ /**************************************************************************** - * RRDtool 1.2.12 Copyright by Tobi Oetiker, 1997-2005 + * RRDtool 1.2.23 Copyright by Tobi Oetiker, 1997-2007 **************************************************************************** * rrd_graph_helper.c commandline parser functions * this code initially written by Alex van den Bogaerdt @@ -133,6 +133,10 @@ rrd_parse_find_gf(const char *const line, unsigned int *const eaten, graph_desc_ rrd_set_error("Malformed '%s' command in line '%s'\n",&line[*eaten],line); return 1; } + if (line[*eaten] == '\0') { + rrd_set_error("Expected some arguments after '%s'\n",line); + return 1; + } return 0; } @@ -256,7 +260,7 @@ int rrd_parse_print(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, image_desc_t *const im) { /* vname:CF:format in case of DEF-based vname ** vname:CF:format in case of CDEF-based vname - ** vname:format in case of VDEF-based vname + ** vname:format[:strftime] in case of VDEF-based vname */ if ((gdp->vidx=rrd_parse_find_vname(line,eaten,gdp,im))<0) return 1; @@ -279,6 +283,11 @@ rrd_parse_print(const char *const line, unsigned int *const eaten, graph_desc_t get the format at this juncture */ strcpy(gdp->format,gdp->legend); gdp->legend[0]='\0'; + /* this is a very crud test, parsing :style flags should be in a function */ + if (im->gdes[gdp->vidx].gf == GF_VDEF && strcmp(line+(*eaten),":strftime")==0){ + gdp->strftm = 1; + (*eaten)+=strlen(":strftime"); + } return 0; } @@ -624,7 +633,7 @@ rrd_parse_def(const char *const line, unsigned int *const eaten, graph_desc_t *c dprintf("- from line '%s'\n",line); if (rrd_parse_make_vname(line,eaten,gdp,im)) return 1; - i=scan_for_col(&line[*eaten],254,gdp->rrd); + i=scan_for_col(&line[*eaten],sizeof(gdp->rrd)-1,gdp->rrd); if (line[*eaten+i]!=':') { rrd_set_error("Problems reading database name"); return 1;