[rrd-users] C Library Help
Cliff Daniel
cdaniel at Level3.net
Thu Jul 31 03:53:57 MEST 2003
Hello all - I'm having a bit of trouble writing some c code to rrd.
below is a simple routine that purposely builds the same array (debug reasons)
and then calls the rrd_graph function. However, the first call always works
but the next one, and all the rest fail saying " unknown option '6' ".
I suspect it's a memory pointer issue due to my lack of experience in this.
Below is the function and the output. Any help is appreciated.
Solaris 2.6, rrdtool 1.0.39
int graph(char *dir, char *src) {
char *r_graph[16];
char **calcpr;
char tmp[256];
int xsize, ysize, r, i;
r_graph[0] = strdup("graph");
r_graph[1] = strdup("blah.png");
r_graph[2] = strdup("--width");
r_graph[3] = strdup("500");
r_graph[4] = strdup("--height");
r_graph[5] = strdup("200");
r_graph[6] = strdup("--color");
r_graph[7] = strdup("CANVAS#FFFFFF");
r_graph[8] = strdup("--color");
r_graph[9] = strdup("FRAME#FFFFFF");
r_graph[10] = strdup("--color");
r_graph[11]= strdup("SHADEB#FFFFFF");
r_graph[12]= strdup("--start");
r_graph[13]= strdup("-6h");
r_graph[14]= strdup("DEF:total=blah.rrd:total:AVERAGE");
r_graph[15]= strdup("LINE2:total#1000ff");
for (i=0; i<16;i++) {
printf("%d: %s\n", i, r_graph[i]);
}
r = rrd_graph(16, r_graph, &calcpr, &xsize, &ysize);
printf("r=%d, x=%d, y=%d\n", r, xsize, ysize);
return(r);
}
0: graph
1: blah.png
2: --width
3: 500
4: --height
5: 200
6: --color
7: CANVAS#FFFFFF
8: --color
9: FRAME#FFFFFF
10: --color
11: SHADEB#FFFFFF
12: --start
13: -6h
14: DEF:total=blah.rrd:total:AVERAGE
15: LINE2:total#1000ff
r=0, x=595, y=255
0: graph
1: blah.png
2: --width
3: 500
4: --height
5: 200
6: --color
7: CANVAS#FFFFFF
8: --color
9: FRAME#FFFFFF
10: --color
11: SHADEB#FFFFFF
12: --start
13: -6h
14: DEF:total=blah.rrd:total:AVERAGE
15: LINE2:total#1000ff
graph: invalid option -- 6
r=-1, x=595, y=255
unknown option '6'
--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the rrd-users
mailing list