X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=src%2Frrd_xport.c;h=2dbc99d9479baea95493c5e87d0692fae6c0ed29;hp=b943fe2ebe592c410c3d38bf93e11bd43338124c;hb=990fcfb7eec407edfe504f42760bae204e1c074d;hpb=23be36896d8cf89dd9dbcdb2bb62677ca01810f8 diff --git a/src/rrd_xport.c b/src/rrd_xport.c index b943fe2..2dbc99d 100644 --- a/src/rrd_xport.c +++ b/src/rrd_xport.c @@ -1,5 +1,5 @@ /**************************************************************************** - * RRDtool 1.0.37 Copyright Tobias Oetiker, 1997 - 2000 + * RRDtool 1.2rc9 Copyright by Tobi Oetiker, 1997-2005 **************************************************************************** * rrd_xport.c export RRD data ****************************************************************************/ @@ -10,7 +10,7 @@ #include "rrd_graph.h" #include "rrd_xport.h" -#ifdef WIN32 +#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) #include #include #endif @@ -43,12 +43,8 @@ rrd_xport(int argc, char **argv, int *xsize, { image_desc_t im; - int i; - long long_tmp; time_t start_tmp=0,end_tmp=0; - char symname[100]; - long scancount; - struct time_value start_tv, end_tv; + struct rrd_time_value start_tv, end_tv; char *parsetime_error = NULL; rrd_graph_init(&im); @@ -91,12 +87,11 @@ rrd_xport(int argc, char **argv, int *xsize, } break; case 'm': - long_tmp = atol(optarg); - if (long_tmp < 10) { + im.xsize = atol(optarg); + if (im.xsize < 10) { rrd_set_error("maxrows below 10 rows"); return -1; } - im.xsize = long_tmp; break; case '?': rrd_set_error("unknown option '%c'", optopt); @@ -121,116 +116,12 @@ rrd_xport(int argc, char **argv, int *xsize, im.start = start_tmp; im.end = end_tmp; - - for(i=optind;i=1){ - if(strstart <= 0){ - im.gdes[im.gdes_c-1].legend[0] = '\0'; - } else { - scan_for_col(&argv[i][argstart+strstart],FMT_LEG_LEN,im.gdes[im.gdes_c-1].legend); - } - if((im.gdes[im.gdes_c-1].vidx=find_var(&im,varname))==-1){ - im_free(&im); - rrd_set_error("unknown variable '%s'",varname); - return -1; - } - } else { - im_free(&im); - rrd_set_error("can't parse '%s'",&argv[i][argstart]); - return -1; - } - break; - default: - break; - } - + im.step = max((long)im.step, (im.end-im.start)/im.xsize); + + rrd_graph_script(argc,argv,&im,0); + if (rrd_test_error()) { + im_free(&im); + return -1; } if (im.gdes_c == 0){ @@ -376,8 +267,10 @@ rrd_xport_fn(image_desc_t *im, if ((legend_list[j] = malloc(sizeof(char) * (FMT_LEG_LEN+5)))==NULL) { free(srcptr_list); free(ref_list); + free(*data); *data = NULL; + while (--j > -1) free(legend_list[j]); free(legend_list); - rrd_set_error("malloc xprint legend entry"); + rrd_set_error("malloc xport legend entry"); return(-1); } @@ -394,8 +287,8 @@ rrd_xport_fn(image_desc_t *im, } /* fill data structure */ - for(dst_row = 0; dst_row < row_cnt; dst_row++) { - for(i = 0; i < nof_xports; i++) { + for(dst_row = 0; (int)dst_row < (int)row_cnt; dst_row++) { + for(i = 0; i < (int)nof_xports; i++) { j = ref_list[i]; ii = im->gdes[j].vidx; ds_cnt = &im->gdes[ii].ds_cnt;