From 9c0eb8f975b928e19ec9460f60448eac956cb9f9 Mon Sep 17 00:00:00 2001 From: oetiker Date: Fri, 1 Feb 2008 06:52:56 +0000 Subject: [PATCH] fixed parsing of fontnames with embeded spaces git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@1274 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/rrd_graph.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/program/src/rrd_graph.c b/program/src/rrd_graph.c index bb7b1b66..96f859b0 100644 --- a/program/src/rrd_graph.c +++ b/program/src/rrd_graph.c @@ -3498,19 +3498,24 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im) case 'n':{ char prop[15]; double size = 1; - char font[1024] = ""; - + int end; if(sscanf(optarg, - "%10[A-Z]:%lf:%1000s", - prop,&size,font) >= 2){ + "%10[A-Z]:%lf%n", + prop,&size,&end) >= 2){ int sindex,propidx; if((sindex=text_prop_conv(prop)) != -1){ for (propidx=sindex;propidx 0){ im->text_prop[propidx].size=size; - } - if (strlen(font) > 0){ - strcpy(im->text_prop[propidx].font,font); + } + if (strlen(prop) > end){ + if (prop[end] == ':'){ + strncpy(im->text_prop[propidx].font,prop+end+1,255); + im->text_prop[propidx].font[255] = '\0'; + } else { + rrd_set_error("expected after font size in '%s'",prop); + return; + } } if (propidx==sindex && sindex != 0) break; } -- 2.30.2