X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_graph.c;h=c60717fa0828784601476464480d6d33a7e2f6dd;hb=88ec7a41d5ba332d0a902a17c0ef0cb01d133a30;hp=ef3c727135411d773f9054c3eea3ec8481a04518;hpb=d0371d8311c9008255a6e50ff296f349f74e10e5;p=rrdtool.git diff --git a/src/rrd_graph.c b/src/rrd_graph.c index ef3c727..c60717f 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -2477,11 +2477,11 @@ graph_paint(image_desc_t *im, char ***calcpr) if (strcmp(im->graphfile,"-")==0) { + fo = im->graphhandle ? im->graphhandle : stdout; #ifdef WIN32 /* Change translation mode for stdout to BINARY */ - _setmode( _fileno( stdout ), O_BINARY ); + _setmode( _fileno( fo ), O_BINARY ); #endif - fo = stdout; } else { if ((fo = fopen(im->graphfile,"wb")) == NULL) { rrd_set_error("Opening '%s' for write: %s",im->graphfile, @@ -2569,12 +2569,13 @@ scan_for_col(char *input, int len, char *output) ** - script parsing now in rrd_graph_script() */ int -rrd_graph(int argc, char **argv, char ***prdata, int *xsize, int *ysize) +rrd_graph(int argc, char **argv, char ***prdata, int *xsize, int *ysize, FILE *stream) { image_desc_t im; rrd_graph_init(&im); - + im.graphhandle = stream; + rrd_graph_options(argc,argv,&im); if (rrd_test_error()) { im_free(&im); @@ -2704,7 +2705,7 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im) char scan_gtm[12],scan_mtm[12],scan_ltm[12],col_nam[12]; time_t start_tmp=0,end_tmp=0; long long_tmp; - struct time_value start_tv, end_tv; + struct rrd_time_value start_tv, end_tv; gfx_color_t color; parsetime("end-24h", &start_tv);