X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_graph.c;h=4b9cb6c9a27a764bb08b950f273cca1a794dbaf1;hb=d8c5e46b26d3870f3d52c7e8ad5eb2adf534503d;hp=d63dbc5dce0bc3a27576d4d156d7185f1313da23;hpb=3f3ba4efe16c38860f9ec66c6219711af435e366;p=rrdtool.git diff --git a/src/rrd_graph.c b/src/rrd_graph.c index d63dbc5..4b9cb6c 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -1,5 +1,5 @@ /**************************************************************************** - * RRDtool 1.2rc4 Copyright by Tobi Oetiker, 1997-2005 + * RRDtool 1.2rc5 Copyright by Tobi Oetiker, 1997-2005 **************************************************************************** * rrd__graph.c produce graphs from data in rrdfiles ****************************************************************************/ @@ -2850,7 +2850,7 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im) {0,0,0,0}}; int option_index = 0; int opt; - + int col_start,col_end; opt = getopt_long(argc, argv, "s:e:x:y:v:w:h:iu:l:rb:oc:n:m:t:f:a:I:zgjFYAMX:S:NT:", @@ -3021,13 +3021,25 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im) break; case 'c': if(sscanf(optarg, - "%10[A-Z]#%8lx", - col_nam,&color) == 2){ + "%10[A-Z]#%n%8lx%n", + col_nam,&col_start,&color,&col_end) == 2){ int ci; + int col_len = col_end - col_start; + switch (col_len){ + case 6: + color = (color << 8) + 0xff /* shift left by 8 */; + break; + case 8: + break; + default: + rrd_set_error("the color format is #RRGGBB[AA]"); + return; + } if((ci=grc_conv(col_nam)) != -1){ im->graph_col[ci]=color; } else { rrd_set_error("invalid color name '%s'",col_nam); + return; } } else { rrd_set_error("invalid color def format");